• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

<mvc:annotation-driven/> Vs <context:annotation-config/>

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends..

According to my spring mvc knowledge <mvc:annotation-driven/> and <context:annotation-config/> these both are used to detect the annotations like @Controller,@ResponseBody,..

could anyone tell me the exact difference between these two tags in dispatcher-servlet.xml

Thanks in advance.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<mvc:annotation-driven/> is a tag added in Spring 3.0 which does the following:

1. Configures the Spring 3 Type ConversionService (alternative to PropertyEditors)
2. Adds support for formatting Number fields with @NumberFormat
3. Adds support for formatting Date, Calendar, and Joda Time fields with @DateTimeFormat, if Joda Time is on the classpath
4. Adds support for validating @Controller inputs with @Valid, if a JSR-303 Provider is on the classpath
5. Adds support for support for reading and writing XML, if JAXB is on the classpath (HTTP message conversion with @RequestBody/@ResponseBody)
6. Adds support for reading and writing JSON, if Jackson is o n the classpath (along the same lines as #5)


<context:annotation-config/>
Looks for annotations on beans in the same application context it is defined and declares support for all the general annotations like @Autowired, @Resource, @Required, @PostConstruct etc etc.

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also to point out.

<context:annotation-config> does NOT search for @Component, @Controller, etc.

<context:component-scan> DOES search for those @Component annotations, as well as the annotations that <context:annotation-config/> does.

Mark
 
Rakesh Basani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you very much for your replies guys..
 
reply
    Bookmark Topic Watch Topic
  • New Topic