注解篇

@Configuration:

Spring的配置标签 , 打了这个标签的类 ,可以被识别为 Spring的配置类 相当于 application-context.xml 就有了


@Conditional:

给方法填加一个条件,如果不满足,这个bean将不会定义 。。。。给方法贴一个条件 , 如果不满足条件 , 这个bean将不会被定义
* 这个方法需要有个条件,系统是window


@Bean:

Spring的Bean标签 ,打了这个标签的方法所返回的实例就会自动叫给Spring容器管理


@Configuration

@ComponentScan(basePackages = "cn.itsource._05_scan" ):ioc组件自动扫描,使用basePackages
  • 指定扫描的包,当然也可以不指定扫描的包,如果不指定,那么就扫描当前包及其子包

@Conditional :

注解篇_第1张图片
@SpringBootApplication:

@SpringBootConfiguration:
@Enable


image.png

你可能感兴趣的:(注解篇)