1.Spring Web MVC
1.1 DispatcherServlet
java configuration 配置 DispatcherServlet
public static MyWebApplicationInitializer implements WebApplicationInitializer{ @Override public void onStartup(ServletContext servletCxt){ //Load Spring web application configuration AnnotationConfigWebApplicationContext ac = new AnnotationConfigWebApplicationContext(); ac.register(AppConfig.class); ac.refresh(); //Create and register the DispatcherServlet DispatcherServlet servlet = new DispatcherServlet(ac); ServletRegistration.Dynamic registration = servletCxt.addServlet("app",servlet); registration.setLoadStartup(1); registration.addMapping("app/*"); } }
1.1.1 Context Hierachy
1.1.2 Special Bean Types
- HandlerMapping : 主要实现 RequestMappingHandlerMapping 和SimpleUrlHandlerMapping
- HandlerAdapter :
- HandlerExceptionResolver: 异常策略
- ViewResolver: 视图解析
- LocaleResolver,LocaleContextResolver: 本地化策略
- ThemeResolver: 个性化策略
- MultipartResover: 多内容解析
- FlashMapManager:存储和传递请求,用来重定向
来源:https://www.cnblogs.com/zhouyu0-0/p/12591210.html