Comments are being updated… (PS: @ symbol is no longer marked)

First understand the composition of annotations and their custom annotations:

A. Target shows the scope of use of annotations, such as packages, constructors, classes, methods, properties, local variables, and parameters. Retention indicates that valid environments for annotations, such as Java files (original files), class files, or runtime class files, are valid at runtime. Inherited indicates parent-child inheritance. When used, it indicates that subclasses can inherit annotations from the parent class. By default, Inherited is not inherited. Describe the Documented annotation

Deprecated — The mark method is obsolete

@PostConstruct

The counterpart to this annotation is the PredeStory. To understand the function of this annotation, we need to go through the Spring bean life cycle. The annotation is mainly decorated on the method, which needs to be used under the class containing the Component annotation, and then the method is decorated by this annotation after all the beans of the project are instantiated. It calls the target method when all of its dependencies have been injected. So the annotation execution order is Component > Autowried (Reosurce) > PostConstruct

@Configuration is currently a Configuration class

@ ComponentScan scan packages

@PropertySource configuration file scan, used with the property annotation @Value(” ${property.key} “)

@import introduces other configuration classes

The @Bean adds the method return object to the SpringIOC container

@ Component as a bean

The policy taken by @Autowired is injected by type, with the attribute annotation @Qualifier (name = “aliasName”) alias to fetch the corresponding attribute

@Resource is automatically injected by ByName by default, and is abolished after JDK11. If you need to introduce it, you need to introduce the java-Annotation -API jar

@lazy indicates that the class is in Lazy loading mode

The @Override method overrides the identity