I am using Spring DAO and ibatis with struts, without tying the two together.
I have basically modified the configuration explained here: http://opensource.atlassian.com/confluence/oss/display/IBATIS/Converting +iBATIS+DAO+to+Spring+DAO I have a ServeletContextListener that creates a singleton configuration object, using Spring to populate its set of variables that hold references to daos: public void contextInitialized(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); this.springContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); CoreApplicationConfig config = CoreApplicationConfig.getInstance(); config.setUserDaoService((UserDAOService)springContext.getBean("userDaoService")); } In my action I do this: ApplicationConfig config = CoreApplicationConfig.getInstance(); UserDAOService userDaoService = config.getUserDaoService(); If I ever want to replace Spring, my struts actions will never know. Dave You wrote: Hi there, We have an application where we are using Struts as our web framework and IBATIS in the data layer. We upgraded to the new version of ibatis which required to upgrade the DAO's to Spring DAO's. To use the Spring DAO's we started to use spring with struts. The only purpose of Spring was to inject the dao's into the service classes and into my Struts Action. However , this approach ties my Struts framework with Spring. Because, the beans.xml file tries to see Struts Action classes as Beans to do its injection. <action-mappings> <action path="/employeeSetUp" name="employeeForm" type="org.springframework.web.struts.DelegatingActionProxy" This approach however, ties Ibatis to Spring and forces us to use Spring in our web layer as well. Can I use Spring DAO's without doing dependency injection? Has anyone used Ibatis Spring DAO's in Struts without making Struts aware of the existence of Spring. Any pointers are appreciated.
