自定义一个配置文件,名为xxx.properties
在所需使用的类上,加上@ConfigurationProperties、@PropertySource
@PropertySource("classpath:http-client.properties") 注明文件路径
@ConfigurationProperties(prefix = "http") 使用http开头的属性
自定义一个配置文件,名为xxx.properties
在所需使用的类上,加上@ConfigurationProperties、@PropertySource
@PropertySource("classpath:http-client.properties") 注明文件路径
@ConfigurationProperties(prefix = "http") 使用http开头的属性
本文标题:springBoot/maven 自定义配置文件及属性值获取
本文链接:https://www.haomeiwen.com/subject/cuiwpftx.html
网友评论