annotation meaning of <mvc:annotation-driven/>
<mvc:annotation-driven/> is a shorthand form that can be manually configured to replace this shorthand form, which allows beginners to quickly apply the default configuration scheme. <mvc:annotation-driven/> Automatically registers defaultannotationhandlermapping with Annotationmethodhandleradapter two beans, is required by spring MVC to distribute requests for @controllers.
and provides: Data binding support, @NumberFormatannotation support, @DateTimeFormat support, @Valid support, read-write XML support (JAXB), read and write JSON support (Jackson).
Later, we used the support for JSON when we handled the response to the AJAX request.
Later, when you write the JUnit unit test for the action, you take the defaultannotationhandlermapping and annotationmethodhandleradapter two beans from the spring IOC container. To complete the test, take the time to know is <mvc:annotation-driven/> This sentence registered two beans.
<context:annotation-config> declares support for general annotations such as @Required, @Autowired, @PostConstruct , and so on.
<mvc:annotation-driven/> is actually rather pointless. It declares explicit support for Annotation-driven MVC controllers (i.e. @RequestMapping, @Controller, etc), even though Su Pport for those is the default behaviour.
My advice are to always declare <context:annotation-config> but don ' t bother with <mvc:annotation-driven UN Less you want JSON support via Jackson.