spring.jar是包含有完整發布的單個jar 包,spring.jar中包含除了spring-mock.jar裏所包含的內容外其它全部jar包的內容,由於只有在開發環境下才會用到 spring-mock.jar來進行輔助測試,正式應用系統中是用不得這些類的。html
除了spring.jar文件,Spring還包括有其它13個獨立的jar包,各自包含着對應的Spring組件,用戶能夠根據本身的須要來選擇組合本身的jar包,而沒必要引入整個spring.jar的全部類文件。java
1、只是使用spring框架
dist\spring.jar
lib\jakarta-commons\commons-logging.jarnode
若是使用到了切面編程(AOP),還須要下列jar文件
lib\aspectj\aspectjweaver.jsr 和 aspectjrt.jar
lib\cglib\cglib-nodep-2.1_3.jarmysql
若是使用了JSR-250中的註解如@Resource/@PostConstruct/@PreDestroy
還需下列jar文件
lib\j2ee\common-annotations.jarweb
2、只是使用spring框架若使用註解方式
只要加一些命名空間和開啓解析器
而且@Resource須要加lib\j2ee\common-annotations.jar
<context:annotation-config/>打開處理器spring
3、要自動掃描
只要開啓解析器和一些命名空間
<context:component-scan base-package=""/>sql
4、spring框架採用aop編程
須要導入一些命名空間
xmlns:aop.......
<aop:aspectj-autoproxy/>開啓解析器
若是使用到了切面編程(AOP),還須要下列jar文件
lib\aspectj\aspectjweaver.jsr 和 aspectjrt.jar
lib\cglib\cglib-nodep-2.1_3.jar數據庫
5、spring+Jdbc開發
須要數據源文件 lib\jakarta-commons\commons-pool.jar、lib\jakarta-commons\commons-dbcp.jar
一、spring文件 :express
dist\spring.jar、
lib\jakarta-commons\commons-logging.jar
二、jdbc驅動文件 MySQL**** sql*** :
導入tx命名空間
<tx:annotation-driven transaction-manager=""/>
對事務註解的解析器編程
6、spring2.5+hibernate3.3+struts1.3
(1)、hibernate核心包
hibernate3.jar
lib\required\*.jar
lib\optional\ehcache-1.2.3.jar (二級緩存文件)
hibernate註解包
lib\test\slf4j-log4j12.jar
(2)、spring包
dist\spring.jar
lib\jakarta-commons\commons-logging.jar 和commons-pool.jar、commons-dbcp.jar(後爲數據源文件)
dist\modules\spring-webmvc-struts.jar (與struts1的集成)
lib\aspectj\aspectjweaver.jsr 和 aspectjrt.jar (Aop文件)
lib\cglib\cglib-nodep-2.1_3.jar (Aop文件)
lib\j2ee\common-annotations.jar (註解文件)
lib\log4j\log4j-1.2.15.jar
(3)、sturs1.3.8
建議將jstl-1.0.2.jar和standard-1.0.2.jar文件更換爲1.1版本 此時JSTL文件
還有spring已存在antlr-2.7.6.jar文件因此將struts中的antlr-2.7.6.jar文件刪除以避免衝突
數據庫驅動
mysql*** sql****根據需求換
若是在web容器實例spring容器
加文件到web.xml......
若是action讓容器管理,則path(Struts的配置文件)和name(Spring配置文件)要一致
還必須在struts的配置文件里加一個控制器
spring爲struts1.3解決亂碼問題
在web.xml配置一個filter
7、spring2.5+hibernate3.3+struts2整合開發
struts2文件lib裏面全部不帶-plugin結尾的jar文件,但除了struts2-spring-plugin-2.0.11.1.jar
http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/overview.html#overview-modules
GroupId | ArtifactId | Description |
---|---|---|
org.springframework |
spring-aop |
Proxy-based AOP support |
org.springframework |
spring-aspects |
AspectJ based aspects |
org.springframework |
spring-beans |
Beans support, including Groovy |
org.springframework |
spring-context |
Application context runtime, including scheduling and remoting abstractions |
org.springframework |
spring-context-support |
Support classes for integrating common third-party libraries into a Spring application context |
org.springframework |
spring-core |
Core utilities, used by many other Spring modules |
org.springframework |
spring-expression |
Spring Expression Language (SpEL) |
org.springframework |
spring-instrument |
Instrumentation agent for JVM bootstrapping |
org.springframework |
spring-instrument-tomcat |
Instrumentation agent for Tomcat |
org.springframework |
spring-jdbc |
JDBC support package, including DataSource setup and JDBC access support |
org.springframework |
spring-jms |
JMS support package, including helper classes to send and receive JMS messages |
org.springframework |
spring-messaging |
Support for messaging architectures and protocols |
org.springframework |
spring-orm |
Object/Relational Mapping, including JPA and Hibernate support |
org.springframework |
spring-oxm |
Object/XML Mapping |
org.springframework |
spring-test |
Support for unit testing and integration testing Spring components |
org.springframework |
spring-tx |
Transaction infrastructure, including DAO support and JCA integration |
org.springframework |
spring-web |
Web support packages, including client and web remoting |
org.springframework |
spring-webmvc |
REST Web Services and model-view-controller implementation for web applications |
org.springframework |
spring-webmvc-portlet |
MVC implementation to be used in a Portlet environment |
org.springframework |
spring-websocket |
WebSocket and SockJS implementations, including STOMP support |