@Configuration
@EnableWebMvc
public class WebAppConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/css/**").addResourceLocations("/css/");
}
}
Spring 4 Annotation based equivalent of static resource mapping
-
18-07-2023 - |
Domanda
I just converted an XML configured Spring MVC project to being annotation based but I cannot seem to figure out what annotation to use (and where to place it) for static resource mappings. The mappings in my project's older XML based configuration were:
<mvc:resources mapping = "/css/**" location = "/css/"/>
<mvc:resources mapping = "/images/**" location = "/images/"/>
<mvc:resources mapping = "/*.html" location = "/"/>
Any help appreciated.
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow