Configure the jar packages required by spring

spring.jar is a single jar package that contains a complete release. spring.jar contains the contents of all other jar packages except those contained in spring-mock.jar, because spring-mock is only used in the development environment .jar for auxiliary testing, these classes are not used in formal application systems.
In addition to the spring.jar file, Spring also includes 13 other independent jar packages, each of which contains the corresponding Spring components. Users can choose and combine their own jar packages according to their own needs without introducing all the classes of the entire spring.jar. document.
(1) spring-core.jar
This jar file contains the basic core tool classes of the Spring framework. The classes in this package must be used by other Spring components, which are the basic core of other components. Of course, you can also use them in your own application system. use these tool classes.
(2) spring-beans.jar
This jar file is used by all applications. It contains all classes related to accessing configuration files, creating and managing beans, and performing Inversion of Control / Dependency Injection (IoC/DI) operations. If the application only needs basic IoC/DI support, you can import the spring-core.jar and spring-beans.jar files.
(3) spring-aop.jar
This jar file contains the classes required to use Spring's AOP features in an application. Use AOP-based Spring features, such as Declarative Transaction Management, and include this jar 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 needed to use the Spring ApplicationContext feature, all the classes needed by JDNI, the UI classes used to integrate with templating engines such as Velocity, FreeMarker, JasperReports, and the related classes for validation.
(5) spring-dao.jar
  This jar file contains all classes for data access by Spring DAO and Spring Transaction. In order to use declarative transaction support, you also need to include spring-aop.jar in your application.
(6) spring-hibernate.jar
  This jar file contains all 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's extension of the DAO feature set to support iBATIS, JDO, OJB, and TopLink, because Hibernate has been packaged independently and is now not included in this package. Most of the classes in this jar file depend on the classes in spring-dao.jar. When using this package, you need to include the spring-dao.jar package at the same time.
(9) spring-remoting.jar
  This jar file contains classes that support EJB, JMS, and remote call Remoting (RMI, Hessian, Burlap, Http Invoker, JAX-RPC).
(10) spring-support.jar
  This jar file contains classes that support Cache (ehcache), JCA, JMX, mail services (Java Mail, COS Mail), and task scheduling (Timer, Quartz).
(11) spring-web.jar
  This jar file contains the core classes required when using the Spring framework during Web application development, including classes that automatically load the WebApplicationContext feature, Struts and JSF integration classes, file upload support classes, Filter classes and lots of tool helper classes.
(12) spring-webmvc.jar
  This jar file contains all classes related to the Spring MVC framework. Contains FreeMarker, JasperReports, Tiles, Velocity, and XSLT related classes for internationalization, tags, Theme, and view presentation. Of course, if your application uses a standalone MVC framework, you don't need any of the classes in this JAR file.
(13) spring-mock.jar
  This jar file contains a whole set of mock classes of Spring to assist application testing. The Spring test suite uses a large number of mock classes to make testing easier. Mocking the HttpServletRequest and HttpServletResponse classes is handy for unit testing web applications.

How to choose these distributions and deciding which distributions to use is actually quite simple:
1) If you are building a web application and will use Spring throughout, then it is best to use a single all spring.jar file;
2) If your application only uses To a simple Inversion of Control / Dependency Injection (IoC/DI) container, then only spring-core.jar and spring-beans.jar are enough;
3) If you have high requirements for the size of the release, then you have to choose carefully After careful selection, only take the jar file that contains the features you need.
By using a separate distribution you can avoid including all the classes that your application doesn't need. Of course, you can use other tools to try to make the entire application package smaller. The key to saving space is to find out exactly the Spring dependency classes you need, and then merge the required classes and packages.
Eclispe has a plugin called ClassPath Helper that can help you find dependent classes.
Spring package dependency description:
1) spring-core.jar requires commons-collections.jar, and spring-core.jar is the basic of the following.
2) spring-beans.jar requires spring-core.jar, cglib-nodep-2.1_3.jar
3) spring-aop.jar requires spring-core.jar, spring-beans.jar, cglib-nodep-2.1_3.jar , aopalliance.jar
4) spring-context.jar需spring-core.jar,spring-beans.jar,spring-aop.jar,commons-collections.jar,aopalliance.jar
5) spring-dao.jar需spring-core.jar,spring-beans.jar,spring-aop.jar,spring-context.jar
6) spring-jdbc.jar需spring-core.jar,spring-beans.jar,spring-dao.jar
7) spring-web.jar需spring-core.jar,spring-beans.jar,spring-context.jar
8) spring-webmvc.jar需spring-core.jar/spring-beans.jar/spring-context.jar/spring-web.jar
9) spring-hibernate.jar需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需spring-core.jar,spring-beans.jar,spring-aop.jar,spring-dao.jar,spring-jdbc.jar,spring-web.jar,spring-webmvc.jar
11) spring-remoting.jar requires spring-core.jar, spring-beans.jar, spring-aop.jar, spring-dao.jar, spring-context.jar, spring-web.jar, spring-webmvc.jar
12 ) spring-support.jar requires spring-core.jar, spring-beans.jar, spring-aop.jar, spring-dao.jar, spring-context.jar, spring-jdbc.jar
13) spring-mock.jar requires spring-core.jar, spring-beans.jar, spring-dao.jar, spring-context.jar, spring-jdbc.jar
First, just use the spring framework
dist\spring.jar
lib\jakarta-commons\commons-logging. jar
If you use Aspect Programming (AOP), you also need the following jar files
lib\aspectj\aspectjweaver.jsr and aspectjrt.jar
lib\cglib\cglib-nodep-2.1_3.jar
If you use the annotations in JSR-250 such as @Resource /@PostConstruct/@PreDestroy
also needs the following jar file
lib\j2ee\common-annotations.jar

2. Just use the spring framework if you use the annotation method,
just add some namespaces and open the parser
and @Resource needs to add lib\j2ee\common-annotations.jar
to open the processor

3. To scan automatically,
just open the parser and some namespaces

Fourth, the spring framework uses aop programming, you
need to import some namespaces
xmlns:aop....
Open the parser
If you use aspect programming (AOP), you also need the following jar files
lib\aspectj\aspectjweaver.jsr and aspectjrt.jar
lib\cglib\ cglib-nodep-2.1_3.jar

5. Spring+Jdbc development
requires data source files lib\jakarta-commons\commons-pool.jar, lib\jakarta-commons\commons-dbcp.jar
1. Spring files:
dist\spring.jar,
lib\jakarta-commons\ commons-logging.jar
2, jdbc driver file mysql**** sql***:
import tx namespace parser

for transaction annotation

Six, spring2.5+hibernate3.3+struts1.3
(1), hibernate core package
hibernate3.jar
lib\required*.jar
lib\optional\ehcache-1.2.3.jar (secondary cache file)
hibernate annotation 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 (after the data source file)
dist \modules\spring-webmvc-struts.jar (integration with struts1)
lib\aspectj\aspectjweaver.jsr and aspectjrt.jar (Aop file)
lib\cglib\cglib-nodep-2.1_3.jar (Aop file)
lib\j2ee \common-annotations.jar (annotation file)
lib\log4j\log4j-1.2.15.jar
(3), sturs1.3.8 It is
recommended to replace the jstl-1.0.2.jar and standard-1.0.2.jar files with version 1.1 JSTL file at this point
There is also an antlr-2.7.6.jar file in spring, so delete the antlr-2.7.6.jar file in struts to avoid conflicts

Database driver
mysql*** sql**** Change according to demand

If you
add a ...

If the action is managed by the container, the path (Struts configuration file) and name (Spring configuration file) must be consistent,
and a controller must be added to the struts configuration file

Spring solves the problem of garbled characters for struts1.3 Configure a filter
in web.xml

7. Spring2.5+hibernate3.3+struts2 integrates and develops
all jar files without -plugin in the struts2 file lib, except for struts2-spring-plugin-2.0.11.1.jar

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324650921&siteId=291194637