Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216

Spring配置类
@Configuration 指定当前页面是一个配置类
@ComponentScan(“com.itheima”) 通过注解指定spring在创建容器是要扫描的包
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
补充:@configuration
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
补充:@ComponentScan找两个包
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
@Bean把当前方法的返回值作为Bean对象,传入spring的ioc容器中
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
有了上面的三个注解,就可以用注解法替代xml法,来配置Spring项目
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
xml注解法


@scope设为多态示例

Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
junit中AnnotationConfigApplicationContext
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216
一次整两个类,从这里传入就不需要在类上面写上面的注解@configuration了
Spring基础: @Configuration, @ComponentScan,@scope,AnnotationConfigApplicationContext,20191216