Reputation: 197
I have been in the process of upgrading a Spring MVC app that was using Framework 2.5.6, Security 2.0.4, and Web Services 1.5. In researching the newer versions, I've realized that Spring 3.1.0 and 3.0.7 deprecate the inheritance for controllers in favor of annotation driven configuration. I understand that annotations are the way forward with Spring configuration but in my situation the people who will be configuring default values for dependency injection cannot edit src files.
The process at my company is like this:
(If I had a chance to build a configuration module into the app, it would have already been done. So for now we're stuck with managing XML configurations.)
So how would an annotation configuration work in my case? It seems to me like it is not a feasible solution given the architecture of our product. Isn't the main goal of annotation-driven configuration to have the developer manage dependency injection within src files instead of XML files?
Does anyone know a way to have only XML configuration in Spring 3?
EDIT: I found this: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-java-combining so I think I can migrate all the controllers to use annotations but leave other beans as they are since controller configurations are not touched very often by our customization team.
Upvotes: 1
Views: 1820
Reputation: 46872
i'm not a great expert on this, but i am using spring 3.1 in a current project and there's still plenty of xml configuration: the application as a whole is assembled from a bunch of beans defined in foo-servlet.xml (so i have daos that are plugged into controller beans etc). my controllers certainly have annotations on the methods associated with incoming HTTP requests, but they are for things like URL parameters - the kind of details that are tightly tied to the code. and i use annotation and type-driven injection in tests because it's quick and easy.
so i'm a bit confused reading your question. it's possible i am misunderstanding, or my case is different, but it sounds a bit like you're over-estimating how much you need to use annotations. i use them where it seems to make sense, but stick with xml where that seems best...
Upvotes: 2