annotation meaning

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.