Spring: define @RequestMapping value in a properties file

It should be possible to use placeholders in @RequestMapping, like for example @RequestMapping("${foo.bar}"). Take a look at the documentation for more details:

Patterns in @RequestMapping annotations support ${…​} placeholders against local properties and/or system properties and environment variables. This may be useful in cases where the path a controller is mapped to may need to be customized through configuration. For more information on placeholders, see the javadocs of the PropertyPlaceholderConfigurer class.

Leave a Comment