If you want to drive mapping out of a prop file, then you can do it as below
In you application.properties, add the key value pair
url.mapping : /test/sample
On the controller you can the do the following:
@Controller
@RequestMapping(value = { "${url.mapping}" })
public class CustomerController{
Instead of providing in prop file, if you provide the url.mapping
as a jvm arg
, then you don’t have to recompile if you change the value, just restart (which i hope you can do, have not tried it myself) should do the trick.
For multiple mappings, you will have to add one per mapping and map that in controller like below.
@Controller
@RequestMapping(value = { "${url.mapping}","${url.mapping.two}" })
public class CustomerController{