@Configuration regards a class as an IoC container, and if @Bean is registered on one of its method headers, it will be used as a Bean in the Spring container.
@Scope annotation scope
@Lazy(true) means lazy initialization
@Service is used to annotate business layer components,
@Controller is used to annotate control layer components (such as actions in struts)
@Repository is used to annotate data access components, namely DAO components.
@Component refers to components in general. When components are not well classified, we can use this annotation for annotation.
@Scope is used to specify the scope of the scope (used on the class)
@PostConstruct is used to specify the initialization method (used on the method)
@PreDestory is used to specify the destruction method (used on the method)
@Resource is assembled by name by default. Beans that do not match the name will be assembled by type.
@DependsOn: Define the order of Bean initialization and destruction @Primary:
When there are multiple Bean candidates during automatic assembly, the bean annotated as @Primary will be the first choice, otherwise an exception will be thrown.
@Autowired is assembled by type by default. If we want to use assembly by name, we can use it in conjunction with @Qualifier annotation
@Autowired @Qualifier("personDaoBean") There are multiple instances for use
Common annotations and instructions of SpringBoot
Guess you like
Origin blog.csdn.net/ke369093457/article/details/89678698
Ranking