In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What this article shares with you is about what the core framework architecture of spring framework is. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Many people are using spring to develop java projects, but when configuring maven dependencies, it is not clear which spring jar should be configured, often adding a bunch randomly, compiling or running errors will continue to configure jar dependencies, resulting in spring dependency confusion, and even the next time to create the same type of project do not know which spring dependencies to configure, only copy, in fact, that's what I did!
There are only about 20 jar packages in spring, each with corresponding functions, and a jar may also rely on several other jar, so it is easy to figure out the relationship between them and configure maven dependency. for example, what jar is required to use the spring framework in an ordinary java project? Just one.
Org.springframework
Spring-context
3.2.17.RELEASE
What about introducing spring mvc into the web project? As long as you configure a dependency
Org.springframework
Spring-webmvc
3.2.17.RELEASE
Why can it be configured in this way? Next, let's take the spring 3.2.17.RELEASE version as an example to introduce the spring framework structure. Spring 4 is slightly different, which will be introduced at the end.
The official website of spring gives a structure diagram of spring3.
In the figure, the spring is divided into five parts: core, aop, data access, web, and test. Each rounded rectangle in the figure corresponds to a jar. If configured in maven, the "groupId" of all these jar is "org.springframework", and each jar has a different "artifactId". In addition, "instrumentation" has two jar and a "spring-context-support" figure is not listed, so there are a total of 19 jar packets for spring3.
The jar and dependencies of these five parts are described below.
Core
The core section contains 4 modules
Spring-core: the most basic implementation of dependency injection IoC and DI
The assembly of spring-beans:Bean factory and bean
The context context of spring-context:spring is the IoC container
Spring-expression:spring expression language
Their complete dependencies
Because spring-core depends on commons-logging and other modules rely on spring-core, the whole spring framework depends on commons-logging. If you have your own log implementation such as log4j, you can eliminate the dependence on commons-logging, exclude commons-logging dependency without log implementation, and compile errors.
Org.springframework
Spring-context
3.2.17.RELEASE
Commons-logging
Commons-logging
Aop
The aop section contains 4 modules
Spring-aop: aspect-oriented programming
Spring-aspects: integrated AspectJ
Spring-instrument: provides some class-level tool support and ClassLoader-level implementation for servers
Spring-instrument-tomcat: instrument implementation for tomcat
Their dependencies
Data access
The data access section contains 5 modules
Support for spring-jdbc:jdbc
Spring-tx: transaction control
Spring-orm: object-relational mapping, integrated orm framework
Spring-oxm: object xml mapping
Spring-jms:java message service
Their dependencies
Web
The web section contains 4 modules
Spring-web: basic web functions, such as file upload
Spring-webmvc:mvc implementation
Spring-webmvc-portlet: mvc implementation based on portlet
Spring-struts: integration with struts, not recommended, spring4 is no longer available
Their dependencies
Test
There is only one module in the test section. I'll put the spring-context-support here, too.
Spring-test:spring testing, providing junit and mock testing functions
Additional support packages for spring-context-support:spring, such as mail service, view parsing, etc.
Their dependencies
This is the end of the introduction of the structure of spring3. Looking at these pictures, I'm sure you won't get confused when you configure spring dependencies in maven.
The following describes the structure of spring4. Spring4 is basically the same as spring3. Here is the structure diagram given on the official website.
As you can see, the struts of spring3 is removed, messaging and websocket are added, and other modules remain unchanged, so there are 20 jar for spring4.
Spring-websocket: an efficient communication tool for web applications
Spring-messaging: used to build message-based applications
Their dependencies
The above is what the core framework architecture of spring framework is, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.