I have to admit, I was very impressed with Ryan Breidenbach’s Spring JavaConfig talk tonight at the Spring Dallas User Group. I don’t hide the fact that I’m a big fan of xml configuration, and very much against annotation-driven config. However, I don’t think I have a problem with doing my bean wiring in Java. I’ll have to sleep on it, and then look at some code and blogs tomorrow before I yeah or neah it, but I kind of liked what I saw tonight.
One of the keys behind xml config, is having a central location to see how your app is wired, and you still have that with JavaConfig. You get stronger type safety, there is no need to cast your bean from Object, and you get built-in IDE refactoring. Ryan did a nice job showing off a lot of advanced bean-wiring methods in JavaConfig.
If you want to learn more about Spring JavaConfig go to the source and read more at the projects homepage.
Who likes Spring MVC out there? Are you using annotation-driven Spring MVC with the 2.5 features? To me all the @RequestMapping annotations just make controller code harder to read. Call me crazy, but I’m out on annotations for doing my Spring configuration. I greatly prefer configuring my beans in common xml files that are easy to view/edit without digging through a bunch of packages / classes.
What drove me to write this post? I saw Craig Walls give a great talk on Spring MVC and Spring Security tonight at the Spring Dallas User Group. He did a good job selling the 2.5 features, but I think he did a better job selling the 2.0 mvc features. I like the idea of using ControllerClassNameHandlerMapping and InternalResourceViewResolver and getting a nice case of convention over configuration. So I guess some good conventions are better then having to go digging through source code for what my annotations are.
If you want more info, check out Craig’s presentation, which you can download from his site.