Need to verify the older way of defining handler mappings using mvc:annotation-driven?
In an app I'm looking at I find this in the dispatcher xml:
<mvc:annotation-driven />
Am I correct that this is the Spring 3 way of defining handler mappings (url routes). One of the controllers in the app looks like this:
@Controller
@RequestMapping("/order")
@SessionAttributes(OrderController.ORDER)
public class OrderController
{
//...
I assume that the line
@RequestMapping("/order")
is the actual definition of the handler mapping for this url route.
Am I correct that the older way of defining this handler mapping would have been with one of:
BeanNameUrlHandlerMapping
SimpleUrlHandlerMapping
ControllerClassNameHandlerMapping开发者_Python百科
CommonsPathMapHandlerMapping
Yes. <mvc:annotation-driven />
is a convenience option for configuring Annotation-driven controllers. It configures special HandlerMapping
s and HandlerAdapter
s.
See the section in the Spring reference manual about <mvc:annotation-driven/>
for a full list of what specifying this actually does.
As an alternative, you could always specify the DefaultAnnotationHandlerMapping
, AnnotationMethodHandlerAdapter
, etc. beans yourself manually.
精彩评论