[quote]@Order(1)
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[] { 。。。};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] { 。。。};
}
@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
registration.setInitParameter("throwExceptionIfNoHandlerFound", "true");
}
}[/quote]
spring4 webconfig通常继承WebMvcConfigurerAdapter
WebMvcConfigurerComposite会调用webconfig中的方法
最终是WebMvcConfigurationSupport
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[] { 。。。};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] { 。。。};
}
@Override
protected void customizeRegistration(ServletRegistration.Dynamic registration) {
registration.setInitParameter("throwExceptionIfNoHandlerFound", "true");
}
}[/quote]
spring4 webconfig通常继承WebMvcConfigurerAdapter
WebMvcConfigurerComposite会调用webconfig中的方法
最终是WebMvcConfigurationSupport