I am trying to develop application with spring 3 MVC not using annotations. I have several reasons for it (I like central configuration place, I do not want to put HTTP-specific info in my controller, I do like XML files and my IDE (intellij IDEA) has good support for it).
At first, I need URL-TO-Controller mapping. It can be achieved using BeanNameUrlHandlerMapping
. Although this method was eliminated from 3.0 documentation ("obsoleted by annotations") but it still works.
Then I need to map GET parameters to some bean with properties. In struts they have i开发者_Python百科t by default:(
I can use BaseCommandController
. It is deprecated but I can use @SuppressWarnings
to get rid of ugly message.
bindAndValidate
will populate command object after it.
At least I need to map path variables (from uri templates) to make my URLs readable. And I am lost here. Look: https://jira.springsource.org/browse/SPR-5757
BaseCommandController
works only with GET/POST.
I can fetch map from request using UriTemplate
. But bindAndValidate
accepts HttpServletRequest
and I cannot add parameters to it: map is read-only. I can decorate it but... too many hacks!
Too many hacks for so simple needs. Hacks, deprecated classes and BaseCommandController
which is undocumented in 3.0.
Is it possible to make app using spring mvc 3.0 w/o of annotations? Or I should use something else (like struts-2) for MVC?
精彩评论