<mvc:annotation-driven/>做? [英] What does <mvc:annotation-driven /> do?

查看:25
本文介绍了<mvc:annotation-driven/>做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 REST API 中使用文件名(例如:GET http://xxx/api/myImage.jpg)问题是@PathVariable 删除了.jpg".这个问题已经在这里问过几次并回答了.但对我不起作用.

I use filenames in my REST API (example: GET http://xxx/api/myImage.jpg) problem is @PathVariable dropped ".jpg". this problems already asked few times in here and answered. but not worked to me.

所以我搜索然后在

https://jira.springsource.org/browse/SPR-6524

"... 根本不应该与手动 DefaultAnnotationHandlerMapping 实例结合使用;这目前被设计为一个非此即彼的选择,与 和 非常相似."

"... is simply not supposed to be combined with manual DefaultAnnotationHandlerMapping instances; this is designed as an either-or choice at present, quite similar to and ."

mvc 命名空间是进行简化的配置".

"mvc namespace are make simplifed configurations".

真正的问题是mvc是做什么的?并改变了?

Real question is mvc what does do? and changed?

我发现我自己这些东西..

I found my self these things..

  1. 拦截器配置已更改.(bean 配置中需要 mvc namspace)
  2. useDefaultSuffixPattern 不起作用.
  3. 添加了 JSON 消息转换器.如果杰克逊图书馆可用
  4. @PathVariable 参数会自动添加到模型中

还有其他的吗?

提前致谢!

推荐答案

mvc:annotationDriven 标签实质上设置了您的 Spring 上下文,以允许将请求分派到控制器.

The mvc:annotationDriven tag essentially sets you your Spring context to allow for dispatching requests to Controllers.

该标签将配置两个 bean DefaultAnnotationHandlerMapping 和 AnnotationMethodHandlerAdapter.

The tag will configure two beans DefaultAnnotationHandlerMapping and AnnotationMethodHandlerAdapter.

您可以从 spring 文档中找到更多信息:

You can find more information from the spring documents:

http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html

这篇关于<mvc:annotation-driven/>做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆