In the parent class FrameworkServlet of DispatcherServlet, there is a piece of code:
public void onApplicationEvent(ContextRefreshedEvent event) { this.refreshEventReceived = true; onRefresh(event.getApplicationContext()); }
@Override protected void onRefresh(ApplicationContext context) { initStrategies(context); } /** * Initialize the strategy objects that this servlet uses. * <p>May be overridden in subclasses in order to initialize further strategy objects. */ protected void initStrategies(ApplicationContext context) { initMultipartResolver(context); initLocaleResolver(context); initThemeResolver(context); initHandlerMappings(context); initHandlerAdapters(context); initHandlerExceptionResolvers(context); initRequestToViewNameTranslator(context); initViewResolvers(context); initFlashMapManager(context); }
Here, the refresh event of the spring container is monitored, which will be called in the publish event in the abstartappcontionContext class, the onrefresh method is called, the springmvc is initialized, a policy is loaded, and some classes are created. If not specified, the default class is taken.
http://www.cnblogs.com/fangjian0423/p/springMVC-directory-summary.html
1. Explain in detail how to find the correct Controller when requesting SpringMVC
2. Explain the working principle of parameters in the method of Controller in SpringMVC