文档介绍:spring mvc注解(Spring MVC注解)
spring mvc注解(Spring MVC注解)
***@Autowired
(not recommended, recommended to use ***@Resource)?
***@Autowired can annotate member variables, methods, and constructors to complete automatic assembly work.
The ***@Autowired's annotation positions are different, and they all automatically assemble this property when Spring initializes the bean.
To enable ***@Autowired to work, you also need to include the following Xml code in the configuration file?
<bean? Class= / >
""?
***@Autowired can annotate members, variables, methods, and constructors
***@Component
Is a generalization of the concept that only represents a component (Bean) that can be applied at any level.
***@Constroller
Usually at the control level, but the function is the same as ***@Component.
***@PostConstruct
Annotation methods are triggered when Boss Bean is created at the start of the Spring container
***@PreDestroy
The annotation method is triggered when the Spring container is destroyed and destroyed when Boss Bean is executed
***@Qualifier
The XX in ***@Qualifier ("XXX") is the name of Bean, so when ***@Autowired and ***@Qualifier are combined, the auto injection policy changes from byType to byName.
***@Qualifier's annotation objects are member variables, method entry, and constructor admission.
***@Repository
Why