63 4.2.2.1 Reduce coupling, p.63 ,
Dependency Injection) by Spring in the Spring bean configuration file In the DAO, make it extends Spring's HibernateDaoSupport to integrate Spring and Hibernate integration. And Struts 2 action is no longer need to extend the ActionSupport ,
we need to create an xml to declare the Spring's beans: Action, Business object and Data access object ,
http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.orgXMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema, 2001. ,
usersBo " class="pilotage.database.login.UsersBoImpl" > <property name="usersBo DAO " ref="usersBo DAO " /> <value>pilotage/metier/Users.hbm.xml</value> </list> </property> </bean> </beans> Then, create an xml file (SpringBeans.xml) which is a core Spring's bean configuration file ,
WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.orgXMLSchema-instance" xsi:schemaLocation="http, 2001. ,
Struts 2 in Action, 2008. ,
Hibernate in Action, 2005. ,
EJB 3 in Action, 2007. ,
WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.orgXMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml, 2001. ,