Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the knowledge points related to Spring in java

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "what are the Spring related knowledge points in java", the content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn "what are the Spring related knowledge points in java" this article.

1) IOC: control inversion, the selection control of a specific implementation class of an interface is removed from the calling class and handed over to a third party, that is, the Spring container controls it through Bean configuration.

2) DI: Dependency injection, so that the dependency of the calling class on an interface implementation class is injected by a third party (container or collaboration class) to remove the dependency of the calling class on an interface implementation class.

IOC is divided into three types: constructor injection, attribute injection and interface injection. Spring supports constructor injection and attribute injection

4) ClassLoader

A class loader is a component that finds the bytecode file of a class and constructs it to represent an object inside the JVM. In Java, the class loader loads a class into the JVM by going through the following steps:

(1) Loading: Find and import Class files

(2) Links:

A. Verification: Check the correctness of the data loaded into the Class file

B. Preparation: Allocating storage space for static variables of a class

C. Resolution: converting symbolic references into direct references

(3) Initialization: perform initialization work on static variables and static code blocks of the class

ClassLoader and its subclasses are responsible for class loading. ClassLoader is responsible for finding and loading Class bytecode files at runtime. The JVM generates three ClassLoaders at runtime: a heel loader, an ExtClassLoader, and an AppClassLoader. The root loader is not a subclass of ClassLoader. It is written in C++ language, so it cannot be seen in Java. The root loader is responsible for loading the core class libraries of JRE, such as rt.jar, charsets.jar, etc. under the JRE target. ExtClassLoader and AppClassLoader are subclasses of ClassLoader, where ExtClassLoader is responsible for loading JAR class packages in JRE extension directory ext;AppClassLoader is responsible for loading class packages under Classpath path

Following Loader is the parent loader of ExtClassLoader, which is the parent loader of AppClassLoader. By default, AppClassLoader is used to load the classes of your application

JVM loads classes using the overall responsibility delegation mechanism. Overall responsibility means that when a ClassLoader loads a class, unless another ClassLoader is explicitly used, the classes that the class depends on and references are also loaded by this ClassLoader. Delegation mechanism means that the parent loader is entrusted to find the target class first, and only if it cannot be found, it will find and load the target class from its own classpath.

Attribute injection requires the Bean to provide a default constructor and a corresponding Setter method for the attribute to be injected. Spring instantiates the Bean object by calling the Bean's default constructor, and then injects property values by calling the Setter method through the reflected method

SprIng only checks whether there is a corresponding Setter method in the Bean, and does not require whether there is a corresponding attribute member change in the Bean.

JavaBean also allows attribute variable names that begin with an upper case letter, but must meet the requirement that the first two letters of the variable are either all upper case or all lower case.

8) A label interface is an interface without any methods and attributes. It does not have any semantic requirements for the implementation class, but only indicates that its implementation class belongs to a specific type. It has two main purposes: first, to identify classes of the same type through the tag interface, which may not have the same methods themselves, such as the Advice interface; second, to make the program or JVM take some special processing through the tag interface, such as java.io.Serializable, which tells the JVM that objects can be serialized.

9), AOP related nouns

(1) join points: a class or a piece of program code has some specific points with boundary properties, Spring only supports join points of methods

(2) Tangent point: Locating a specific connection point by tangent point

(3) Enhancement: Weaving a piece of program code into the target class connection point

(4) Target object: enhanced logic woven into the target class

Introduction: Introduction is a special enhancement that adds properties and methods to a class.

(6) Weaving: The process of adding enhancements to specific connection points of the target class

(7) Proxy: When a class is enhanced by AOP weaving, it produces a result class, which is a proxy class that blends the original class and the enhanced logic.

(8) Section: Section consists of tangent point and enhancement

10), enhanced type

(1) Pre-enhancement: org.springframework.aop.BeforeAdvice stands for pre-enhancement, which means that the enhancement is implemented before the target method is executed.

(2) Post-enhancement: org.springframework.aop.AfterReturningAdvice stands for post-enhancement, indicating that enhancements are implemented before and after the target method is executed.

(3) Surround enhancement: org.aopalliance.intercept.MethodInterceptor stands for Surround enhancement, indicating that enhancement is performed before and after the target method is executed.

(4) Exception throwing enhancement: org.springframework.aop.ThrowsAdvice stands for exception throwing enhancement, indicating that enhancement is implemented after the target method throws an exception.

(5) Introduction Enhancement: org.springframework.aop.IntroductionInterceptor stands for introduction enhancement, which means adding some new methods and attributes to the target class.

ThreadLocal is a container that holds thread localization objects. When an object running in a multithreaded environment uses ThreadLocal to maintain a variable, ThreadLocal assigns a separate copy of the variable to each thread that uses the variable. So each thread can change its own copy independently without affecting the copies of other threads.

InheritableThreadLocal inherits from ThreadLocal, which automatically copies a copy of the inherited local variables from the parent thread for the child thread: When creating a child thread, the child thread receives the initial values of all inheritable thread local variables

ThreadLocal class has a Map, used to store a copy of each thread variable, Map element keys for thread objects, values for the corresponding thread variable copy

Synchronization mechanism adopts the way of exchanging time for space, access serialization and object sharing; ThreadLocal adopts the way of exchanging space for time: access parallelism and object exclusivity

12) SpringMVC Flow Chart

The above is "Java Spring related knowledge points what" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report