1.spring框架(概述)
-
- Spring框架中可用的功能模块有:(spring官网参考资料)
- Dependency Injection(IoC)
- Aspect-Oriented Programming including Spring's declarative transaction management(AOP)
- Spring MVC web application and RESTful web service framework
- Foundational support for JDBC, JPA, JMS
- Much more…
- All avaible features and modules are described in the Modules section of the reference documentation. Their maven/gradle coordinates are also described there.
- 构成spring框架的所有模块
- The Spring Framework consists of features organized into about 20 modules. These modules are grouped into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, Messaging, and Test, as shown in the following diagram.
-
All avaible features and modules are described in the Modules section of the reference documentation.
- 在spring开发包中,上图所示各个模块被分开打包成“spring-模块名称-版本号.RELEASE.jar”,(e.g.
spring-core-4.3.4.RELEASE.jar
,spring-webmvc-4.3.4.RELEASE.jar
,spring-jms-4.3.4.RELEASE.jar
, etc.). 实际工程中,并不需要将spring的所有模块都包含进你的工程,你可以根据实际需要只选择你的工程能够用到的那几个模块对应的jar包添加至你的工程中就可以了。 - 另外,spring框架的所有jar包以及spring框架所依赖的其他jar包都可以在maven的中央仓库找到,所以如果你的工程是使用maven进行管理的,那么你的工程中引入spring时将会变得非常便捷:因为maven会自动从maven的中央仓库下载你的项目所依赖的spring的jar包以及spring所依赖的其他jar包到maven local repository中,
- 如何使用spring
step1,明确spring是支持maven的
Each release of the Spring Framework will publish artifacts to the following places:
-
-
-
-
- Maven Central, which is the default repository that Maven queries, and does not require any special configuration to use. Many of the common libraries that Spring depends on also are available from Maven Central and a large section of the Spring community uses Maven for dependency management, so this is convenient for them. The names of the jars here are in the form
spring-*-<version>.jar
and the Maven groupId isorg.springframework
. - ArtifactId见下表
-
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
- 如果你决定使用maven管理你的软件工程,那么如何使用maven为你的项目自动添加spring框架的相关jar包呢?详细教程参见如下链接:使用maven为我的项目添加spring相关jar包
- So the first thing you need to decide is how to manage your dependencies: we generally recommend the use of an automated system like Maven, Gradle or Ivy, but you can also do it manually by downloading all the jars yourself.
- Maven Central, which is the default repository that Maven queries, and does not require any special configuration to use. Many of the common libraries that Spring depends on also are available from Maven Central and a large section of the Spring community uses Maven for dependency management, so this is convenient for them. The names of the jars here are in the form
-
-
-