user2775185
user2775185

Reputation: 1207

difference between <mvc:annotation /> and AnnotationMethodHandlerAdapter bean

i was working on the spring - mvc. and we were using AnnotationMethodHandlerAdapter bean declaration in *-servlet.xml file. As we were exploring Spring REST we came across ... is there any difference and which is better to use. Can someone answer please ?

Upvotes: 2

Views: 1085

Answers (1)

M. Deinum
M. Deinum

Reputation: 125232

The <mvc:annotation-driven /> tag registers, amongs other things, a AnnotationMethodHandlerAdapter or if you are on Spring 3.1+ a RequestMappingHandlerAdapter. It will register a whole lot more and saves you from explicitly defining all that beans. (If you are on Spring 3.1 or up I strongly urge you to remove the AnnotationMethodHandlerAdapter and to use the more powerful and flexible RequestMappingHandlerAdapter).

What is all registered and how to customize it is explained in the reference guide.

Upvotes: 2

Related Questions