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