spring注解 springboot为什么要configuration而不用component?

springboot为什么要configuration而不用component?component是生成一个实体,类似于xml中定义一个bean configuration是声明一个配置项,即相当于新

springboot为什么要configuration而不用component?

component是生成一个实体,类似于xml中定义一个bean configuration是声明一个配置项,即相当于新增一个xml文件

@configuration和@component之间的区别?

@configuration和@component之间的区别是:@Component注解的范围最广,所有类都可以注解,但是@Configuration注解一般注解在这样的类上:这个类里面有@Value注解的成员变量和@Bean注解的方法,就是一个配置类。

spring中Component和@Configuration分别是什么意思?

Spring 注解@Component,@Service,@Controller,@Repository Spring 2.5 中除了提供 @Component 注释外,还定义了几个拥有特殊语义的注释,它们分别是:@Repository、@Service 和 @Controller。