目录
application.properties表示是springboot的配置文件。
2,@Bean,@Component,@Service,@Repository,@Controller
4,@ImportResource(classpath:xxx.xml),原生配置文件引入。
application.properties表示是springboot的配置文件。
在里面设置一些配置文件的值。
1,@Configuration+@Bean
表示是一个配置bean == spring配置文件中的bean标签
2,@Bean,@Component,@Service,@Repository,@Controller
以前注解继续使用。只要能够扫描到就可以。@ComponentScan(basePackage),
@Import(class) 与其他自定义bean连用或者其他类。一起实例化。
3,@Conditional
条件装配:满足Conditional指定的条件,进行组件注入。
根注解,衍生出很多条件注解。
4,@ImportResource(classpath:xxx.xml),原生配置文件引入。
5,配置绑定的引入。(@Component)
把读取到的properties文件的内容,并把它封装到Javabean中,以供随时使用。
1,spring中是@PropertySource(path)+@Value("${key}")
而springboot中是
2,@ConfigurationProperties(prefix="前缀点")。+@Component【在其他properties中先使用@PropertiesResource("filePath")】,自动注入。。
如果没法配置@Component注解,使用
3,@EnableConfigurationProperties(类.class)+@ConfigurationProperties(prefix="前缀点")