What has been done behind < mvc:annotation-driven/ >

Spring,xml,@Controller,@Autowired,
@RequestMapping,@Service;

,xml:
     <context:component-scan base-package="..."/>
:
     <mvc:annotation-driven/>
     
??
           

their roles do not coincide.

The function of

context:component-scan is to scan the corresponding base-package, to scan the classes annotated by @ Component , @ Controller , @ Service , @ Repository in the corresponding Bean. These Bean provide the most basic support for Spring MVC to register a Bean, in the context.

< hr >

while < mvc:annotation-driven/ > provides additional support for MVC. Refer to Spring official document , < mvc:annotation-driven/ > the main function is to register HandlerMapping (implemented as DefaultAnnotationHandlerMapping) and HandlerAdapter (implemented as AnnotationMethodHandlerAdapter). These two Bean provide the ability to forward requests for @ Controllers (all controllers). There are other features available for MVC:

  • Using the Spring 3 Type ConversionService as a simpler and more robust alternative to JavaBeans PropertyEditors
  • Support for formatting Number fields with @ NumberFormat
  • Support for formatting Date, Calendar, and Joda Time fields with @ DateTimeFormat, if Joda Time is on the classpath
  • Support for validating @ Controller inputs with @ Valid, if a JSR-303 Provider is on the classpath
  • Support for reading and writing XML, if JAXB is on the classpath
  • Support for reading and writing JSON, if Jackson is on the classpath

Please refer to the official documentation for more details.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e819df-b73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e819df-b73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?