Is it possible to define the value of a @RequestMapping
annotation in Spring by defining it in a properties file?
Actually, I do something like:
@Controller
@RequestMapping("/xxx")
public class MyController {
...
}
But I would like to store the path /xxx
in a properties file. Why? For instance, it is less likely that I do mystakes in my templates if I rename the path in the controller.
In other framework this is allowed (see Symfony, for instance).
It should be possible to use placeholders in
@RequestMapping
, like for example@RequestMapping("${foo.bar}")
. Take a look at the documentation for more details:Thx for the help. It is my contribution... No dependencies are necessary because maven do everything by itself.
In the property file - use maven interpolation, such as below:
In your destiny file, for example controller/resource (in mycase):