So i have spend hours to try to get the anwser of this post working:
Overriding RequestMapping on SpringMVC controller
But it really is not working. What I have so far:
springmvc-servlet.xml
<context:property-placeholder location="classpath:numbernick.properties"/>
<context:component-scan base-package="com.numbernick" />
<context:annotation-config />
And I've got a Controller:
@Value("${requestmapping.test}")
private String test;
@RequestMapping("${requestmapping.test}.html")
public ModelAndView test() {
ModelAndView mav = new ModelAndView();
mav.setViewName(test.html);
log.debug("Test: "+test);
return mav;
}
numbernick.properties:
requestmapping.test=myUrl
This should work fine. When I call the page, I get a logmessage saying "Test: myUrl" . BUT! this comes when I call "/${requestmapping.test},html". And it should work with calling "/myUrl.html". I have absolutely no Idea why it is this way. Obviously the PropertyPlaceholder works and doesn't work at the same time. (BTW: It is a nested RequestMapping. But it also doesn't work at topLvl-RequestMapping as well)
How can this be and what can I do to fix this? I'm currently working with spring verion 3.2.8
See Question&Answers more detail:os