Spring each JAR package function (reprint)

Source: Internet
Author: User
Tags log4j

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 spring are used in the class of this package, which is 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, including access to configuration files, creation and management of beans, and inversion of control/dependency injection (ioc/ DI) operations related to all classes. 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 (declarative Transaction 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 Spring ApplicationContext 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, spring transaction 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 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, since 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 classes in the Spring-dao.jar, and you need to include Spring-dao when using this package.Jar package. (9) Spring-remoting.jar This jar file contains classes that support EJB, JMS, Remote call Remoting (RMI, Hessian, Burlap, Http Invoker, Jax-RPC). (Ten) Spring-support.jar this jar file contains support for cache caches (Ehcache), JCA, JMX, mail Service (Java mail, COS Mail), Task Scheduler scheduling (Timer, Quartz) aspects of the class. 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 feature, struts and JSF integration classes, File upload support classes, Filter class and a large number of tool helper classes. Spring-webmvc.jar This jar file contains all the classes related to the Spring MVC 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 be using spring all the way, it's best to use a single full Spring.jar file;  If your app simply uses a simple inversion of control/dependency Injection (IOC/DI) container, then only Spring-core.jar and Spring-beans.jar can;  if you have a high demand for the size of the release, then you have to choose carefully, only the jar file containing the features you need. 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.JAR3)   Spring-aop.jar need SPRING-CORE.JAR,SPRING-BEANS.JAR,CGLIB-NODEP-2.1_3.JAR,AOPALLIANCE.JAR4)   Spring-context.jar need SPRING-CORE.JAR,SPRING-BEANS.JAR,SPRING-AOP.JAR,COMMONS-COLLECTIONS.JAR,AOPALLIANCE.JAR5)  spring-dao.jar need SPRING-CORE.JAR,SPRING-BEANS.JAR,SPRING-AOP.JAR,SPRING-CONTEXT.JAR6)   Spring-jdbc.jar need SPRING-CORE.JAR,SPRING-BEANS.JAR,SPRING-DAO.JAR7)   Spring-web.jar need spring-core.jar,spring-beans.jar,spring-context.jar8)  spring-webmvc.jar need spring-core.jar/ SPRING-BEANS.JAR/SPRING-CONTEXT.JAR/SPRING-WEB.JAR9)  spring-hibernate.jar Required spring-core.jar,spring- BEANS.JAR,SPRING-AOP.JAR,SPRING-DAO.JAR,SPRING-JDBC.JAR,SPRING-ORM.JAR,SPRING-WEB.JAR,SPRING-WEBMVC.JAR10)   Spring-orm.jar need SPRING-CORE.JAR,SPRING-BEANS.JAR,SPRING-AOP.JAR,SPRING-DAO.JAR,SPRING-JDBC.JAR,SPRING-WEB.JAR,SPRING-WEBMVC.JAR11)  spring-remoting.jar Required spring-core.jar,spring-beans.jar,spring- AOP.JAR,SPRING-DAO.JAR,SPRING-CONTEXT.JAR,SPRING-WEB.JAR,SPRING-WEBMVC.JAR12)   Spring-support.jar need Spring-core.jar,spring-beans.jar,spring-aop.jar,spring-dao.jar,spring-context.jar,spring-jdbc.jar13 )  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.
<context:annotation-config/> opening the processor

Third, to automatically scan
Just turn on the parser and some namespaces
<context:component-scan base-package= ""/>

Iv. Spring Framework with AOP programming
Some namespaces need to be imported
Xmlns:aop .....
<aop:aspectj-autoproxy/> Open 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
<tx:annotation-driven transaction-manager= ""/>
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

Spring each JAR package function (reprint)

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.