In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the packaging of Spring". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the packaging of Spring"?
After getting the Spring release package, you may be surprised to find that instead of using a single JAR file to contain all the code, the Spring development team chose to create a single JAR and eight separate JAR files containing the full release to contain the corresponding Spring components. The number of component JAR files in future versions is likely to increase, making it easier for you to choose the features to be included in your code.
Complete release package
The spring.jar file is available in all distributions, which contains almost a complete distribution of the Spring framework class. The reason for saying "pretty much" is that it doesn't actually contain any mock classes, which are released with Spring as auxiliary testing. This is a wise decision for the Spring development team, because you almost never need to distribute mock classes at the same time when you release an application; you just use them in a development environment to assist in the testing process. In addition, the spring.jar file contains all the other classes in the Spring main source tree.
Component release package
In addition to the spring.jar file, Spring includes the eight other JAR files mentioned earlier; one of them contains the mock class and seven separate components that contain Spring framework. Table 2-1 lists these JAR files with descriptions of the corresponding components.
Table 2-1:Spring component release package
The JAR file states that the spring-aop.jar JAR file contains all the classes needed to use the AOP feature of Spring in the application. If you plan to use other AOP-based Spring features, such as declarative transaction management (declarative transaction management), you also need to include this JAR file in your application. The class in the spring-context.jar package provides a large number of extensions for the Spring core. You can find all the classes you need to use the Spring ApplicationContext feature (described in Chapter 5), as well as classes that support EJB, JNDI, and mail integration. In addition, the package includes Spring remote invocation (remoting) classes, classes for integration with template (templating) engines such as Velocity and FreeMarker, and validation base classes (base validation class). It is worth noting that, in fact, it is not appropriate for many classes to be included in this package, and features such as remote calls and EJB support are better packaged into separate JAR files. This JAR file is used by all spring-core.jar applications and contains all the classes related to accessing configuration files, creating and managing bean, and performing DI operations. If your application only needs basic DI support, the JAR file is sufficient to meet your needs. In addition, the JAR file also contains a set of very useful utility classes, which are widely used by the Spring code library and can also be used in your own applications. The JAR file spring-dao.jar contains all the base classes related to Spring DAO support, as well as all classes that use the transaction abstraction layer (transaction abstraction layer) of JDBC and Spring for data access. In order to use declarative transaction support, you also need to include spring-aop.jar in your application.
As mentioned earlier in spring-mock.jar, Spring provides a complete set of mock classes to assist in application testing. The Spring test suite uses a large number of these mock classes, so they have been tested to make your application testing easier. As for the great use of mock HttpServletRequest and HttpServletResponse classes in web application unit testing, it is needless to say. Spring-orm.jar, the JAR file, extends Spring's standard DAO feature set to support Hibernate, iBATIS, and JDO. A large number of classes in this JAR file depend on classes in spring-dao.jar, and there is no doubt that you need to include the latter at the same time. In the future, each ORM tool may be packaged separately, so that your application does not need to include Hibernate and JDO related classes when using iBATIS. Spring-web.jar, a JAR file, contains core classes needed for web applications to use Spring, including classes that automatically load ApplicationContext features, Struts integration classes, file upload support classes, and a large number of auxiliary classes to perform repetitive tasks such as parsing int values in query (query) strings. The JAR file spring-webmvc.jar contains all the classes related to the Spring MVC framework. If your application uses a separate MVC framework, you don't need any classes in this JAR file. Chapter 18 will introduce Spring MVC in more detail.
How to choose to publish a package
Deciding which release packages to choose is actually quite simple. If you are building web applications and will be using Spring throughout the process, it is best to use spring.jar files so as not to get bogged down in maintaining different files. Similarly, if your application only uses a simple DI container, you can do it with spring-core.jar. If you have high requirements for the size of the release, you should choose carefully and use only the JAR files that contain the features you need.
Note that the granularity of the above component release package is actually not that small; however, it is clear that you can at least avoid including all the classes that your application does not need. Maybe you can try to make the whole app a little smaller, but the most important thing to save space is how to accurately identify the Spring dependencies you need, take it and abandon it for the rest.
Thank you for your reading, the above is the content of "what is the packaging of Spring?" after the study of this article, I believe you have a deeper understanding of what the packaging of Spring is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.