摘要: springboot 启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件–file:./config/–file:./–classpath:/config/–classpath:/优先级由高到底,高优先级的配 阅读全文
posted @ 2019-08-21 19:11 测试一枚 阅读(156) 评论(0) 推荐(0) 编辑
摘要: @PropertySource:”加载指定的配置文件:@PropertySource(value = {"classpath:person.properties"}) @ImportResource:导入Spring的配置文件让其生效@ImportResource(locations = {"cla 阅读全文
posted @ 2019-08-21 18:58 测试一枚 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 配置文件yml还是properties他们都能获取到值;如果说,我们只是在某个业务逻辑中需要获取一下配置文件中的某项值,使用@Value;如果说,我们专门编写了一个javaBean来和配置文件进行映射,我们就直接使用@ConfigurationProperties; 阅读全文
posted @ 2019-08-21 16:52 测试一枚 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 学习springboot 的过程中出现了could not autowired no been have been found翻译成成中文就是不能完成自动注入,找不到注入时依赖的相关的bean类 一、解决的方法: 1.查看自己的springboot启动类是否添加了@Component注解,如果没有解 阅读全文
posted @ 2019-08-21 15:51 测试一枚 阅读(8304) 评论(0) 推荐(1) 编辑