spring注解 springboot為什么要configuration而不用component?
springboot為什么要configuration而不用component?component是生成一個實體,類似于xml中定義一個bean configuration是聲明一個配置項,即相當于新
springboot為什么要configuration而不用component?
component是生成一個實體,類似于xml中定義一個bean configuration是聲明一個配置項,即相當于新增一個xml文件
@configuration和@component之間的區(qū)別?
@configuration和@component之間的區(qū)別是:@Component注解的范圍最廣,所有類都可以注解,但是@Configuration注解一般注解在這樣的類上:這個類里面有@Value注解的成員變量和@Bean注解的方法,就是一個配置類。
spring中Component和@Configuration分別是什么意思?
Spring 注解@Component,@Service,@Controller,@Repository Spring 2.5 中除了提供 @Component 注釋外,還定義了幾個擁有特殊語義的注釋,它們分別是:@Repository、@Service 和 @Controller。