Introduction to spring individual jar packages

Source: Internet
Author: User

Article excerpt from: http://blog.sina.com.cn/s/blog_783fd24b01011moa.html thank Bo friends to share O (∩_∩) o~

Spring.jar is a single jar package that contains a full release, and Spring.jar contains all the contents of all the jar packages except those contained in the Spring-mock.jar, as it is only used in the development environment. Spring-mock.jar to carry out the auxiliary test, the formal application system is not used in these classes.

In addition to the Spring.jar file, Spring includes 13 other separate jar packages, each containing a corresponding spring component, which allows the user to choose to assemble their own jar packages, rather than having to introduce all of the Spring.jar's class files.

(1) Spring-core.jar

This jar file contains the basic core tool classes of the spring framework, and the other components of the spring are used in the class of the package, the basic core of other components, and of course you can use these tools in your own application system.

(2) Spring-beans.jar

This jar file is used by all applications and includes all classes that access the configuration file, create and manage beans, and perform inversion of control/dependencyinjection (IOC/DI) operations. If the application requires only basic Ioc/di support, the introduction of Spring-core.jar and Spring-beans.jar files is possible.

(3) Spring-aop.jar

This jar file contains the classes required to use the Spring AOP feature in your app. Using the spring features based on AOP, such as declarative transaction management (Declarativetransaction Management), also include this jar package in your application.

(4) Spring-context.jar

This jar file provides a number of extensions to the spring core. You can find all the classes you need to use the Springapplicationcontext feature, Jdni all the classes that you need, and the UI aspects used with the template (templating) engine such as velocity, Freemarker, JasperReports integrated classes, and related classes for verifying validation.

(5) Spring-dao.jar

This jar file contains all the classes of Spring DAO, springtransaction for data access. In order to use declarative transaction support, you also need to include Spring-aop.jar in your own application.

(6) Spring-hibernate.jar

This jar file contains all of the classes that spring encapsulates for Hibernate 2 and Hibernate 3.

(7) Spring-jdbc.jar

This jar file contains all the classes that encapsulate spring's JDBC data access.

(8) Spring-orm.jar

This jar file contains spring to extend the DAO feature set to support Ibatis, JDO, OJB, TopLink, because Hibernate is already in its own package and is now not included in the package. Most of the classes in this jar file depend on the class in Spring-dao.jar, and you need to include the Spring-dao.jar package when using this package.

(9) Spring-remoting.jar

This jar file contains classes that support EJB, JMS, Remote call Remoting (RMI, Hessian, Burlap, Httpinvoker, Jax-RPC).

(Ten) Spring-support.jar

This jar file contains classes that support cache caches (Ehcache), JCA, JMX, mail services (Java Mail, cosmail), Task Scheduler scheduling (Timer, Quartz).

(one) Spring-web.jar

This jar file contains the core classes required to use the spring framework when developing Web applications, including classes that automatically load the Webapplicationcontext attribute, struts and JSF integration classes, File upload support classes, the filter class, and a large number of tool helper classes.

(Spring-webmvc.jar)

This jar file contains all classes related to the SPRINGMVC framework. Contains Freemarker, JasperReports, Tiles, Velocity, and XSLT related classes for internationalization, labeling, Theme, view presentation. Of course, if your app uses a stand-alone MVC framework, you don't need any classes in this jar file.

(Spring-mock.jar)

This jar file contains the spring set of mock classes to aid in the testing of the application. The Spring test suite uses a large number of these mock classes, which makes testing easier. Simulating the HttpServletRequest and HttpServletResponse classes is convenient for Web application unit testing.

How to choose these packages and decide which ones to use is fairly straightforward.

If you're building a web app and will use spring all the way, it's best to use a single full Spring.jar file;

If your application uses only simple inversion of control/dependencyinjection (Ioc/di) containers, then only Spring-core.jar and Spring-beans.jar can be used;

If you have a high size requirement for a release, then you have to pick and choose only the jar file that contains the attributes you want.

With a standalone release package you can avoid including all classes that your app doesn't need. Of course, you can use other tools to make the entire application package smaller, and the space-saving focus is to pinpoint the spring dependent classes you need, and then merge the required classes and packages.

Eclispe has a plugin called Classpath helper that can help you find the classes you depend on.

Spring Package Dependency Description:

1) Spring-core.jar need Commons-collections.jar,spring-core.jar is the following other basic.

2) Spring-beans.jar need Spring-core.jar,cglib-nodep-2.1_3.jar

3) Spring-aop.jar need Spring-core.jar,spring-beans.jar,cglib-nodep-2.1_3.jar,aopalliance.jar

4) Spring-context.jar need Spring-core.jar,spring-beans.jar,spring-aop.jar,commons-collections.jar,aopalliance.jar

5) Spring-dao.jar Need Spring-core.jar,spring-beans.jar,spring-aop.jar,spring-context.jar

6) Spring-jdbc.jar need Spring-core.jar,spring-beans.jar,spring-dao.jar

7) Spring-web.jar need Spring-core.jar,spring-beans.jar,spring-context.jar

8) Spring-webmvc.jar need Spring-core.jar/spring-beans.jar/spring-context.jar/spring-web.jar

9) Spring-hibernate.jar need spring-core.jar,spring-beans.jar,spring-aop.jar,spring-dao.jar,spring-jdbc.jar,spring-orm.jar,spring -web.jar,spring-webmvc.jar

10) Spring-orm.jar need SPRING-CORE.JAR,SPRING-BEANS.JAR,SPRING-AOP.JAR,SPRING-DAO.JAR,SPRING-JDBC.JAR,SPRING-WEB.JAR,SPRING-WEBMV C.jar

11) Spring-remoting.jar need Spring-core.jar,spring-beans.jar,spring-aop.jar,spring-dao.jar,spring-context.jar,spring-web.jar,spri Ng-webmvc.jar

12) Spring-support.jar need Spring-core.jar,spring-beans.jar,spring-aop.jar,spring-dao.jar,spring-context.jar,spring-jdbc.jar

Spring-mock.jar need Spring-core.jar,spring-beans.jar,spring-dao.jar,spring-context.jar,spring-jdbc.jar

One, just use the spring framework
Dist\spring.jar
Lib\jakarta-commons\commons-logging.jar

If you use slice programming (AOP), the following jar files are also required
LIB\ASPECTJ\ASPECTJWEAVER.JSR and Aspectjrt.jar
Lib\cglib\cglib-nodep-2.1_3.jar

If the annotations in JSR-250 are used such as @resource/@PostConstruct/@PreDestroy
The following jar files are also required
Lib\j2ee\common-annotations.jar

Second, just use the spring framework if you use the annotation method
Just add some namespaces and turn on the parser
and @resource need to add Lib\j2ee\common-annotations.jar.
Turn on the processor

Third, to automatically scan
Just turn on the parser and some namespaces


Iv. Spring Framework with AOP programming
Some namespaces need to be imported
Xmlns:aop .....
Turn on the parser
If you use slice programming (AOP), the following jar files are also required
LIB\ASPECTJ\ASPECTJWEAVER.JSR and Aspectjrt.jar
Lib\cglib\cglib-nodep-2.1_3.jar

V. Development of SPRING+JDBC
Requires data source files Lib\jakarta-commons\commons-pool.jar, Lib\jakarta-commons\commons-dbcp.jar
1. spring File:

Dist\spring.jar,
Lib\jakarta-commons\commons-logging.jar
2. JDBC driver file mysql**** sql***:
Import the TX namespace

Parser for transaction annotations

Liu, spring2.5+hibernate3.3+struts1.3

(1), Hibernate core Pack

Hibernate3.jar
Lib\required\*.jar
Lib\optional\ehcache-1.2.3.jar (Level two cache file)
Hibernate Annotations Package
Lib\test\slf4j-log4j12.jar

(2), Spring package
Dist\spring.jar
Lib\jakarta-commons\commons-logging.jar and Commons-pool.jar, Commons-dbcp.jar (later data source files)
Dist\modules\spring-webmvc-struts.jar (integration with STRUTS1)
LIB\ASPECTJ\ASPECTJWEAVER.JSR and Aspectjrt.jar (AOP files)
Lib\cglib\cglib-nodep-2.1_3.jar (AOP file)
Lib\j2ee\common-annotations.jar (note file)
Lib\log4j\log4j-1.2.15.jar

(3), sturs1.3.8
It is recommended that you replace the Jstl-1.0.2.jar and Standard-1.0.2.jar files with the 1.1 version at this time Jstl file
And spring already exists Antlr-2.7.6.jar file so remove the Antlr-2.7.6.jar file in struts to avoid conflicts

Database-driven
mysql*** sql**** Change According to demand

If the spring container is in the Web container instance
Add files to Web. Xml ...

If the action is managed by the container, the path (the Struts configuration file) and the name (Spring configuration file) are consistent
You must also add a controller to the struts configuration file

Spring solves garbled problems for struts1.3
In Web. XML, configure a filter

VII. integrated development of SPRING2.5+HIBERNATE3.3+STRUTS2

Struts2 file lib contains all the jar files without-plugin ending, except Struts2-spring-plugin-2.0.11.1.jar

Introduction to spring individual jar packages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.