First, the Guide package
Antlr-2.7.7.jar
Asm-3.3.jar
Asm-commons-3.3.jar
Asm-tree-3.3.jar
Com.springsource.com.mchange.v2.c3p0-0.9.1.2.jar
Com.springsource.org.aopalliance-1.0.0.jar
Com.springsource.org.apache.commons.logging-1.1.1.jar
Com.springsource.org.apache.log4j-1.2.15.jar
Com.springsource.org.aspectj.weaver-1.6.8.release.jar
Commons-fileupload-1.3.1.jar
Commons-io-2.2.jar
Commons-lang3-3.2.jar
Dom4j-1.6.1.jar
Freemarker-2.3.22.jar
Geronimo-jta_1.1_spec-1.1.1.jar
Hibernate-commons-annotations-5.0.1.final.jar
Hibernate-core-5.0.7.final.jar
Hibernate-jpa-2.1-api-1.0.0.final.jar
Jandex-2.0.0.final.jar
Javassist-3.18.1-ga.jar
Jboss-logging-3.3.0.final.jar
Jstl-1.2.jar
Log4j-api-2.2.jar
Log4j-core-2.2.jar
Mysql-connector-java-5.1.7-bin.jar
Ognl-3.0.6.jar
Spring-aop-4.2.4.release.jar
Spring-aspects-4.2.4.release.jar
Spring-beans-4.2.4.release.jar
Spring-context-4.2.4.release.jar
Spring-core-4.2.4.release.jar
Spring-expression-4.2.4.release.jar
Spring-jdbc-4.2.4.release.jar
Spring-orm-4.2.4.release.jar
Spring-test-4.2.4.release.jar
Spring-tx-4.2.4.release.jar
Spring-web-4.2.4.release.jar
Standard.jar
Struts2-core-2.3.24.jar
Struts2-spring-plugin-2.3.24.jar
Xwork-core-2.3.24.jar
Second, spring and hibernate integration
Hibernate.cfg.xml
1<?xml version= ' 1.0 ' encoding= ' utf-8 '?>2<! DOCTYPE hibernate-Configuration Public3"-//hibernate/hibernate Configuration DTD 3.0//en"4"Http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd" >5 67<session-factory>8<!--MySQL Database dialect---9<property name= "dialect" >org.hibernate.dialect.MySQLDialect</property>Ten<!--displaying SQL statements-- One<property name= "Show_sql" >true</property> A -<!--introduce a mapping file-- -<mapping resource= "Com/tx/model/user.hbm.xml"/> the</session-factory> -Applicationcontext.xml
1<?xml version= "1.0" encoding= "UTF-8"?>2<beans xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"3Xmlns= "Http://www.springframework.org/schema/beans"4xmlns:context= "Http://www.springframework.org/schema/context"5xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"6xmlns:tx= "Http://www.springframework.org/schema/tx"7Xsi:schemalocation= "Http://www.springframework.org/schema/beans8http//www.springframework.org/schema/beans/spring-beans-4.2.xsd9http//Www.springframework.org/schema/contextTenhttp//www.springframework.org/schema/context/spring-context-4.2.xsd Onehttp//WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP Ahttp//www.springframework.org/schema/aop/spring-aop-4.2.xsd -http//Www.springframework.org/schema/tx -http//www.springframework.org/schema/tx/spring-tx-4.2.xsd the"> - -<!--read Db.properties file-- -<context:property-placeholder location= "Classpath:db.properties"/> +<!--configuring data sources- -<bean id= "DataSource"class= "Com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method= "Close" > +<property name= "Driverclass" value= "${jdbc.driverclass}" ></property> A<property name= "Jdbcurl" value= "${jdbc.url}" ></property> at<property name= "user" value= "${jdbc.user}" ></property> -<property name= "Password" value= "${jdbc.password}" ></property> -</bean> - -<!--integrated Sessionfactory with spring ORM Package -<bean id= "Sessionfactory"class= "Org.springframework.orm.hibernate5.LocalSessionFactoryBean" > in<!--injecting data sources-- -<property name= "DataSource" ref= "DataSource" ></property> to<!--load Hibernate core profile-- +<property name= "configlocation" value= "Classpath:hibernate.cfg.xml" ></property> -</bean> the *<!--hibernate transaction manager with spring rom- $<bean id= "TransactionManager"class= "Org.springframework.orm.hibernate5.HibernateTransactionManager" >Panax Notoginseng<!--injected Sessionfactory-- -<property name= "Sessionfactory" ref= "Sessionfactory" ></property> the</bean> + A<!--configuration-- the<tx:advice id= "Txadvice" transaction-manager= "TransactionManager" > +<tx:attributes> -<tx:method name= "save*" propagation= "REQUIRED"/> $<tx:method name= "update*" propagation= "REQUIRED"/> $<tx:method name= "delete*" propagation= "REQUIRED"/> -<tx:method name= "query*" read-only= "true"/> -</tx:attributes> the</tx:advice> - Wuyi<aop:config> the<!--configuring Pointcuts--and -<aop:pointcut expression= "Execution (* com.tx.service. *.*(..))" Id= "Mycut"/> Wu<aop:advisor advice-ref= "Txadvice" pointcut-ref= "Mycut"/> -</aop:config> About $<!--============== above for spring and Hibernate integration configuration ======================- -<bean id= "Useraction"class= "Com.tx.action.UserAction" scope= "prototype" > -<property name= "UserService" ref= "UserService" ></property> -</bean> A<!--============== above for spring and struts integration ============================-- +<bean id= "Userdao"class= "Com.tx.dao.impl.UserDaoImpl" > the<property name= "Sessionfactory" ref= "Sessionfactory" ></property> -</bean> $<bean id= "UserService"class= "Com.tx.service.impl.UserServiceImpl" > the<property name= "Userdao" ref= "Userdao" ></property> the</bean> the</beans>
Iii. integration of Spring and STRUTS2
Struts.xml
1<?xml version= "1.0" encoding= "UTF-8"?>2<!DOCTYPE Struts public3"-//apache software foundation//dtd Struts Configuration 2.3//en"4"Http://struts.apache.org/dtds/struts-2.3.dtd" >5 6<struts>7<!--# struts.objectfactory =Spring gives the action's creation to the spring container8Struts.objectFactory.spring.autoWire =name Spring is responsible for assembling the action dependency property9-Ten<!--<constant name= "struts.objectfactory" value= "Spring" ></constant>- One A< PackageName= "User" namespace= "/"extends= "Struts-default" > -<action name= "Useraction_*"class= "Useraction" method= "{1}" > -<result name= "Success" >/success.jsp</result> the</action> -</ Package> -</struts> -
struts2+spring4.2+hibernate4.3 Integration