美文网首页
springBoot/maven 自定义配置文件及属性值获取

springBoot/maven 自定义配置文件及属性值获取

作者: 氕氘氚_笔记 | 来源:发表于2018-07-17 13:38 被阅读0次

自定义一个配置文件,名为xxx.properties
在所需使用的类上,加上@ConfigurationProperties、@PropertySource

@PropertySource("classpath:http-client.properties") 注明文件路径
@ConfigurationProperties(prefix = "http")  使用http开头的属性

相关文章

网友评论

      本文标题:springBoot/maven 自定义配置文件及属性值获取

      本文链接:https://www.haomeiwen.com/subject/cuiwpftx.html