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

相关文章:

  • 2021-08-19
  • 2022-01-11
  • 2022-12-23
  • 2022-01-03
  • 2021-11-24
  • 2021-04-23
  • 2022-12-23
  • 2021-04-18
猜你喜欢
  • 2021-12-14
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2021-11-06
  • 2021-09-18
相关资源
相似解决方案