13 Large Framework Integration theory
2 Guide Pack ( for each)
1 Hibernate
1 hibernate/lib/required
2 HIBERNATE/LIB/JPA | Java Persist API Java Persistence Specification (interface)
3. Database-driven
2 struts2
1. struts-blank.war/web-inf/lib/*
2 Struts Integrated Spring plug-in package
3 Spring
4 Tag Library (MyEclipse This step is not required)
3 Configuring the Spring container separately (remember to test)
Create a configuration file and import constraints (4)
Beans|context|aop|tx
Configure Spring to start with a project
after the configuration is finished spring, remember to test it immediately . .
The test method is: Deploy the project to see if there will be an error, no error is said no problem.
4 individually configured struts2 (test)
Configuring The struts2 master configuration file
Configuring The STRUTS2 core filter to Web. xml
after the configuration is complete struts2 remember to test it right away . .
test method: Write a You can test the action.
5 struts2 and spring Integration (test)
1 Guide Pack
2 Configuring Constants
3 Integration Scenarios 1:struts2 own create action,spring responsible for assembling dependency properties
4 Integration Solution 2:spring is responsible for creating the action and assembly.
Test:
6 Configuring Hibernate separately (test)
import entity class &orm metadata
Configure the Master profile : The following China do not configure it .
Note:1 <!--Specify the isolation level when hibernate operates the database--
<property name= "Hibernate.connection.isolation" >4</property>
2.<!--The specified session is bound to the current thread--
<property name= "Hibernate.current_session_context_class" >thread</property>
default configuration file location for hibernate :
Hibernate configuration test requires a separate write class to test .
7 Spring integration hibernate(test)
1 Integration principle
2 Configuring Sessionfactory in Spring
configuration Scenario One :
configuration Scenario Two :
Test :
8 Spring Integrated C3P0 Connection pool (test)
1. Configure Database.properties
2. Introduction of connection pooling into spring
simply configure the registered JDBC properties file in the Applicationcontext.xml (Spring configuration file)
3. Inject the connection pool to the Sessionfactory
9 Spring integrated Hibernate environment Operations database
1 DAO class creation: Inheriting Hibernatedaosupport
operation of 2.hibernate templates
Execute :
Findbycriteria :
Configure DAO in spring :
AOP Transactions in spring
1 Preparatory work
2 XML Configuration AOP transactions
To configure notifications:
To configure the weave in:
3 Annotations Configuring AOP transactions
Opening annotation Transactions
Using annotations in service classes
<tx:annotation-driven transaction-manager= "TransactionManager"/> and <tx:annotation-driven/> , as long as your transaction manager's name is TransactionManager on the line.
11 Extending the session scope
to avoid no-session problems when using lazy loading . The scope of the session needs to be enlarged.
Configure filter :
Any filter must be called before the filter of Struts .
A : as long as the filter of struts is in, it will not be released to the struts process.
The integration of the three major frameworks of 07-spring