I'm trying to find an optimal way to use the latest Spring 3.0. I really like the @RequestMapping annotation with all features applied to it. However, what I don't like, is that the URL bound to the action should be fully specified in the java file.
It would be the best to somehow send the whole url-binding configuration to the context xml file. However, it would also do if that url-binding could be moved to xml at least partially.
This is what I mean:
Current code:
@Controller
@RequestMapping("myController")
class MyController {
@RequestMapping("**/someMethod")
String someMethod(...) {
}
}
This code binds the myController/someMethod to MyController::someMethod. What I don't like here is that "myController" part binding is also in this java file. I want to make it as modular as possible, and this part plays very bad for me.
What I'd like to see is something like this, to achieve the same result:
context.xml
<mapping>
<url>myController</url>
<controller>MyController</controller>
</mapping>
java
@Controller
//-- No request mapping here --// @RequestMapping("myController")
class MyController {
@RequestMapping("**/someMethod")
String someMethod(...) {
}
}
Is something like this possible on annotated controllers in Spring 3?