My static resources stopped working as soon as I added a new Controller (non rest) in my application with the following mapping
@RequestMapping(value = \"/{p
For no controller pages:
@Controller
@RequestMapping("/feature")
public class DataTableController {
// map /feature/* to /feature/*
@RequestMapping(value="/{name}", method = RequestMethod.GET)
public ModelAndView staticPage(@PathVariable String name){
return new ModelAndView("feature/" + name);
}
}
For static resource except for HTML:
@EnableWebMvc
@Configuration
public class WebConfig implements WebMvcConfigurer {
// map /res/ to classpath:/resources/static/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/res/**").addResourceLocations("classpath:/static/");
}
}