我有几个@RequestMapping
值会在某一天从“/XXX”变为“/V100”。所以我需要在属性中定义它。我已经用谷歌搜索了,并且有使用 application.properties 的方法,但我必须将“/XXX”值保留在用户定义的属性中,如“local.properties”。是否可以@RequestMapping
在用户定义的属性上定义值?
@Controller
@RequestMapping("/XXX")
public class MyController {
...
}
**更新:尝试了几个小时并让它工作。
我的属性
api.version=V100
mvc-context.xml
<context:property-placeholder ignore-unresolvable="true" location="/WEB-INF/config/property/my.properties"/>
控制器
@RequestMapping("/${api.version}")
Tomcat日志
localhost-startStop-1> [2016-04-28 15:01:35.410] [INFO] [RequestMappingHandlerMapping] [534] Mapped "{[/V100/detail],methods=[GET]}"...