I work on a team that maintains a big web app based on java and Struts 1. We would like to "try" Spring. Do you think it's a useful approach to select a couple of DAO's and rework them with dependency injection, as a way of proving the concept to our manager, and developing confidence?
Do you mean to say that you are planning only to use Spring for transaction handling and for the data access layer?
To integrate your Struts application with Spring, you have two options:
Configure Spring to manage your Actions as beans, using the ContextLoaderPlugin, and set their dependencies in a Spring context file.
Subclass Spring's ActionSupport classes and grab your Spring-managed beans explicitly using a getWebApplicationContext() method.
We follow the first approach.
Thanks for the quick reply! Yes, we have in mind the first option. I haven't had any exposure to Spring, except in reading *about* it, but my teammate who used it on another project tells me that we can use an applicationContext.xml file to define services, which refer to DAO methods. We annotate our Action classes that have traditionally instantiated a DAO individually and participated in Connection Pool sharing such that "Spring handles the connections." Does that sound right?