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

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