1、导包(43个(有一个重复))
Hibernate
Hibernate/lib/required
required里面所有的jar包
Hibernate/lib/jpa pesrsist api的持久化规范
jpa里所有的jar包
数据库驱动
struts2
struts-blank.war/WEB-INF/lib/*
Struts2整合Spring插件包
struts2-spring-plugin-2.3.24.jar
注意:这个包一旦导入,那么struts2在启动时就会寻找Spring容器。找不到就抛出异常
Spring
基本 4+2
core
beans
context
expression
logging
log4j
整合web:web包
spring-web
整合aop:4个
spring-aop
spring-aspect
aop联盟
aop-weaving
整合Hibernate事务: 4个
spring-jdbc
spring-tx
C3p0
spring-orm
整junit测试:test包
spring-test
标签库 2个
单独配置Spring容器
步骤:
1、创建配置文件,并导入约束(4个)
beans
context
aop
tx
单独配置struts2
1、配置Struts2主配置文件
2、配置struts2核心过滤器到web.xml
struts2与Spring整合
1、导包(struts2-spring-plugin-2.3.24.jar)
2、需要配置常量
### if specified, the default object factory can be overridden here
### Note: short-hand notation is supported in some cases, such as "spring"
### Alternatively, you can provide a com.opensymphony.xwork2.ObjectFactory subclass name here
# struts.objectFactory = spring
### specifies the autoWiring logic when using the SpringObjectFactory.
### valid values are: name, type, auto, and constructor (name is the default)
struts.objectFactory.spring.autoWire = name
<!-- # struts.objectFactory = spring 将aciton的创建交给Spring容器
struts.objectFactory.spring.autoWire = name spring负责装配Action依赖属性
-->