当前位置:Gxlcms > 数据库问题 > springboot中@PropertySource(value = {"classpath:FoundBean.properties"})读取不出内容

springboot中@PropertySource(value = {"classpath:FoundBean.properties"})读取不出内容

时间:2021-07-01 10:21:17 帮助过:135人阅读

所以需要把一些跟springboot无关的东西放在其他文件,用 @PropertySource:加载指定的配置文件;
直接用@PropertySource读取不到值,原因在于@PropertySource需要和@propertyConfiguration一起使用
@Component
@ConfigurationProperties(prefix = "person")

最终要注解内容有:

@Component
@ConfigurationProperties(prefix = "person")
@PropertySource(value={"classpath:/person.properties"})


详情链接

springboot中@PropertySource(value = {"classpath:FoundBean.properties"})读取不出内容

标签:color   原因   yml   font   ica   ring   col   加载   不可   

人气教程排行