1.1 package structure
1. To provide basic IOC capabilities, we just need to look at core/ Context /beans
2. Core provides core utility classes and supports dependency injection
1. Asm corresponds to the ASM bytecode framework, read the source class and parse -> get annotations/methods/member variables... 2. Cglib corresponds to the Cglib bytecode framework -> generate proxy beans (there is a saying that all code you write through Spring is not code you actually run, and all objects are not objects you define directly) 3. Core -> exception handling and versioning, and other core support independent of a particular framework Core. Codec -> Encoding decoder abstraction for byte response streams and Java object conversions 6. Core.convert -> Type conversions 7. The Spring environment abstraction consists of bean definition configuration files and hierarchical property source support. 8. Core. IO -> Common abstraction using (file-based) resources 9. Core. log -> useful delegates for logging conventions 10 Core. task abstracts from ExecuteService, providing TaskExecutor concepts 12. Core. type supports types, reading annotations/class-level metadata/path scanningCopy the code
Beans package
1. The factory BeanDefinition/the BeanFactory/BeanProcessor model and template extension point definition 2. Propertyeditors member variable processing - > different types of member variables provide different processor (3) support Some of the current package support capabilities 4. Under the direct path is accessor for access to bean resourcesCopy the code
The context package
With the development of Spring,context is extended to context, context-Indexer,context-support context-> base IOC container, based on beans package, encapsulating its capabilities, adding internationalization, event propagation Context-indexer -> Class management and CLASspath path scanning context-support -> extended support, and IOC child containers
context
1. The cache - > spring yourself a cache implementation. 2. The context - > container model - > ApplicationContext/ConfigurableApplicationContext ApplicationContextAware/ApplicationStartupAware/EmbeddedValueResolveAware/EnvironmentAware/MessageAware/ResourceLoaderAw are ApplicationContextInitializer ApplicationEvent/ApplicationEventPublisher/ApplicationEventPublisherAware ApplicationListener HierarchicaMessageSource/MessageSource annotation - > annotation ability, relevant selector, reader, parser, registry config -> Provide parser for resource loading, register with a handler, provide base context for namespace extension -> publish/subscribe mode, event broadcaster, event model, listener model, listener factory, listener adapter expression -> Support for expressions, specify abstract/simple handling, reflect i18N -> support for internationalization in the template index-> spI-like spring.ponents load support-> a vote IOC container,refresh() template method needs some handling and support PostprocessorRegistryDelegate - >, for example, in view of the postProcessor registry of some operation, simple said that is a step, this is the template step step, one is what are the steps, one is the way and the sequential steps Weaving -> Support for AppectJ (in XML form) by default, processor extension support 3. Ejb -> Implementation of EJB definitions 4. Format -> FactoryBean provides format 5. Instrument. Based on Java classloading - > Instrument do increase 6. JMX - > support for JMX, j2ee (example - > log4j implementation is often used to run time to modify the log level) 7. Jndi - > Scheduling -> Scheduled tasks 10. Scripting 11. UI 12. Validation 8Copy the code
Here’s an explanation of EJBs
EJB Beans are Enterprise Java Beans. EJB Beans are Enterprise Java Beans. In the absence of Spring, how to use Java for enterprise application development 2. Java introduced J2EE for what purpose 3.EJB is a set of specifications, a set of protocols 4. If EJB is interface, Spring implements the interface subclass 5. However, Java envisages enterprise applications that implement a four-tier model: client, Web, business, and persistence 6. 7. The emergence of Spring simplifies the client layer (Spring MVC), the Web layer and the business layer, so as to support the whole system and not completely use j2ee systemCopy the code
There is a saying that the top companies set standards for Java, J2EE is Java for enterprise applications to develop technical specifications, define the top-level interface system, specific vendors are responsible for implementation
1. Take JDBC as an example, Java supports data access, define the top-level interface system,mysql as a DB vendor decided to support Java, will provide you with a JAR, internal implementation of JDBC interface, complete the data access 2. In order to support Web access, Java provides sockets. Tomcat, as a Web server that supports Java, internally implements socket protocol 3. Now the development of EBJ is replaced by SSM/SSH/Springboot + SpringCloud. 4. J2ee roughly agrees on the overall architecture of Web applications. And the requirements of this aspect made a series of specificationsCopy the code
J2EE model
context-indexer
1. Scan for classes identified by the extension mechanism 2.@index. Spring.ponents 3 will be generated in the meta-INF directory at compile time. When started, @ComponentScan does not scan the specified package, but instead reads Spring.componentsCopy the code
context-support
1. Cache -> Caffeine, a highly efficient local cache, integrates ehCache with spring's pure Java process version cache framework, and Hibernate's default cache framework jCache complies with JSR-107 Java cache transaction Scheduling -> CommonJ Timed task -> Quartz timed task 4. UI. Freemarker -> Freemarker Integration of Freemarker as a JSP templateCopy the code