Top 5 Shocking Omissions from Spring MVC
January 09, 2010 📬 Get My Weekly Newsletter ☞
Been working with Spring MVC recently. My enthusiasm has waned somewhat, as I've discovered that for all of it's tweakability and configurableosity, it omits what I believe to be incredibly obvious things:
- Simple, 80/20 conventions by default - While the phrase "convention over configuration" appears numerous times
in the Spring documentation, it is still unable to call the
foo
method of the classBarController
when I request the urlbar/foo
without a lot of configuration, some of which subtly conflicts and causes silent failures. The default configuration is useless - Debugging the Routing - I shovel angle bracket after annotation after angle bracket into Spring and it simply can not tell me what URL patterns are mapped to where, and why a given URL isn't mapped, nor what to do to get it mapped. It's whole purpose is to map URLs to controllers. Shocking.
- Simple internal routing without magic strings - If I've mapped
FooController
'sbar
method, shouldn't I be able to redirect/route to that in code viaroute(FooController.class,"bar")
, regardless of the specific URL thatFooController
andbar
respond to? Instead, I've got magic strings everywhere and if my urls ever change, god help me. And don't get me started about accessing this stuff via tests. - Simple web-testing - Adding a dependency on JWebUnit doesn't cut it. Jetty and Tomcat cannot hot deploy. How do people test these things??!?!
- Test Fixture Support - I had to hack this up with DBUnit. With maven in the mix, it's a huge hit to productivity, but at least I have it. What project doesn't need this??!?!