Several common HandlerMapping

Name 1.BeanNameUrlHandlerMapping bean roots label to find the corresponding Controller class

2.SimpleUrlHandlerMapping  The bean 's id to find the corresponding Controller class

3.ControllerClassNameHandlerMapping find the corresponding Controller class based on the class name of the bean

 

 

 

 4. Use annotations instead of the configuration information

4.1 Add aop jar package

4.2 Add the following code in the configuration file springmvc

 

 

<! - 1. Pack scan, where the scan develop bags -> 
<context: Scan-base- Component Package = "com.zhiyou100.sh.controller.annoation"> </ context: Component-Scan> 
<! - 2. open drive annotation -> 
<MVC: annotation-driven />

 

Guess you like

Origin www.cnblogs.com/sh-0131/p/11455716.html