摘要: 1、Springboot启动的时候加载主配置类,开启了自动配置功能@EnableAutoConfiguration 2、@EnableAutoConfiguration作用: 1)利用AutoConfigurationImportSelector给容器中导入一些组件; 2)查看selectImpor 阅读全文
posted @ 2020-01-03 15:30 why768 阅读(206) 评论(0) 推荐(0)
摘要: 1、配置文件加载优先级 -file:./config/ -file:./ -classpath:/config -classpath:/ 由高到低、高优先级的覆盖低优先级,互补配置 2、通过spring.config.location来改变默认的配置文件位置 项目打包之后,可以使用命令行参数的形式, 阅读全文
posted @ 2020-01-03 11:19 why768 阅读(379) 评论(0) 推荐(0)
摘要: 1、多Profile文件 在主配置文件编写的时候,文件名可以是 application-{profile}.properties/yml 默认使用application.properties的配置 2、yml支持多文档块方式 3、激活指定profile 阅读全文
posted @ 2020-01-03 10:51 why768 阅读(110) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-01-03 10:29 why768 阅读(165) 评论(0) 推荐(0)
摘要: 1、@PropertySource:加载指定的配置文件 @PropertySource(value = {classpath:person.properties}) 2、@ImportResource:导入Spring的配置文件,让配置文件里面的内容生效 Spring Boot里面没有Spring的 阅读全文
posted @ 2020-01-03 10:09 why768 阅读(264) 评论(0) 推荐(0)
摘要: 1、@ConfiguratinProperties和@Value获取值比较 2、@ConfiguratinProperties默认从全局配置文件中获取值 阅读全文
posted @ 2020-01-03 09:31 why768 阅读(450) 评论(0) 推荐(0)