spring.jar是包含有完整發布的單個jar 包,spring.jar中包含除了spring-mock.jar里所包含的內容外其它所有jar包的內容,因為只有在開發環境下才會用到 spring-mock.jar來進行輔助測試,正式應用系統中是用不得這些類的。
除了spring.jar文件,Spring還包括有其它13個獨立的jar包,各自包含着對應的Spring組件,用戶可以根據自己的需要來選擇組合自己的jar包,而不必引入整個spring.jar的所有類文件。
一、只是使用spring框架
dist\spring.jar
lib\jakarta-commons\commons-logging.jar
如果使用到了切面編程(AOP),還需要下列jar文件
lib\aspectj\aspectjweaver.jsr 和 aspectjrt.jar
lib\cglib\cglib-nodep-2.1_3.jar
如果使用了JSR-250中的注解如@Resource/@PostConstruct/@PreDestroy
還需下列jar文件
lib\j2ee\common-annotations.jar
二、只是使用spring框架若使用注解方式
只要加一些命名空間和開啟解析器
並且@Resource需要加lib\j2ee\common-annotations.jar
<context:annotation-config/>打開處理器
三、要自動掃描
只要開啟解析器和一些命名空間
<context:component-scan base-package=""/>
四、spring框架采用aop編程
需要導入一些命名空間
xmlns:aop.......
<aop:aspectj-autoproxy/>開啟解析器
如果使用到了切面編程(AOP),還需要下列jar文件
lib\aspectj\aspectjweaver.jsr 和 aspectjrt.jar
lib\cglib\cglib-nodep-2.1_3.jar
五、spring+Jdbc開發
需要數據源文件 lib\jakarta-commons\commons-pool.jar、lib\jakarta-commons\commons-dbcp.jar
1、spring文件 :
dist\spring.jar、
lib\jakarta-commons\commons-logging.jar
2、jdbc驅動文件 MySQL**** sql*** :
導入tx命名空間
<tx:annotation-driven transaction-manager=""/>
對事務注解的解析器
六、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
七、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
|