版权声明:本站所提供的文章资讯、软件资源、素材源码等内容均为本作者提供、网友推荐、互联网整理而来(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考,如有侵犯您的版权,请联系我,本作者将在三个工作日内改正。 https://blog.csdn.net/weixin_42323802/article/details/83999617
声明,使用 springboot2.0、JDK8 、maven3.5.4
问题描述: 在springboot中自定义配置文件 other.properties时候,报错;
原因: *使用: @ConfigurationProperties(prefix = “other”) 这个注解,在springboot 2.0版本中,没有 @location 注解,要手动添加@PropertySource(“classpath:other.properties”),并且添加依赖:
*
解决方案: 在pom.xml 中添加依赖;
<dependency>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-configuration-processor </artifactId>
<optional> true </optional>
</dependency>