I would like to add resource handlers using WebMvcConfigurerAdapter in Windows, but in Linux it doesn't work, so I add WebMvcConfigurationSupport
.
After debug and test I find two bean will be create in both OS, but the override function of WebMvcConfigurerAdapter
will be executed only at Windows and the override function of WebMvcConfigurationSupport
will be executed only at Linux.
I can't find out the reason. The two configuration classes are shown below:
@Configuration
public class JxWebAppConfigurer extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("file:"+System.getProperty("user.dir")+"/src/main/webapp/");
super.addResourceHandlers(registry);
}
}
This is the other one:
@Configuration
public class JxWebConfiguration extends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("file:"+System.getProperty("user.dir")+"/src/main/webapp/");
super.addResourceHandlers(registry);
}
}
@EnalbeMvc is already been added at the main class