In Java Spring set variable value in @RequestMapping?

For example I have a variable
private String adminPath="admin";

next, I write so
@RequestMapping(value = { "/${adminPath}" }, method = RequestMethod.GET)
 public String homeAdmin(ModelMap model) {
 model.addAttribute("path", "../templates/home/index");
 return "admin/layout/main";
 }

but nothing gets inserted
I've only been studying java and Spring, here tripped over it. Please help to understand how it works correctly.
I need it to then I could change the value of this variable on admin121212 for example, and don't need to change it everywhere
July 2nd 19 at 17:35
1 answer
July 2nd 19 at 17:37
Solution
private static final String ADMIN_PATH = "admin";

@RequestMapping(value = ADMIN_PATH , method = RequestMethod.GET)
 public String homeAdmin(ModelMap model) {
 model.addAttribute("path", "../templates/home/index");
 return "admin/layout/main";
 }
Thank you. So you can write this @RequestMapping(value = "/"+ADMIN_PATH+"/user/new" , method = RequestMethod.GET) for example - shaun65 commented on July 2nd 19 at 17:40

Find more questions by tags JavaSpring