import org.springframework.web.servlet.DispatcherServlet;
@ComponentScan(basePackages = "com.imooc.web")
public class DispatcherServletConfiguration {
}
public class DefaultAnnotationConfigDispatcherServletInitializer extends
AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() { // web.xml
return new Class[0];
}
@Override
protected Class<?>[] getServletConfigClasses() { // DispatcherServlet
return new Class[]{DispatcherServletConfiguration.class};
}
@Override
protected String[] getServletMappings() {
return new String[]{"/"};
}
}
原文:https://www.cnblogs.com/fjf3997/p/13041485.html