I have several @RequestMapping
which value will subject to change from "/XXX" to "/V100" on someday. So I need to define it in properties. I've googled and there's way using application.properties but I have to keep "/XXX" value in a user defined properties like a "local.properties". Is it possible to define @RequestMapping
value on a user defined properties?
@Controller
@RequestMapping("/XXX")
public class MyController {
...
}
** UPDATE : tried several hours and get it to work.
my.properties
api.version=V100
mvc-context.xml
<context:property-placeholder ignore-unresolvable="true" location="/WEB-INF/config/property/my.properties"/>
controller
@RequestMapping("/${api.version}")
tomcat log
localhost-startStop-1> [2016-04-28 15:01:35.410] [INFO] [RequestMappingHandlerMapping] [534] Mapped "{[/V100/detail],methods=[GET]}"...