SpringBoot读取properties文件中的值
properties文件(test.properties)
xx.xyz.url=http://www.xxx.com/
xx.xyz.name=zhangsan
xx.xyz.clientId=1234456
xx.xyz.clientSecret=miyao
config配置文件
package com.test.sso.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
@PropertySource("classpath:test.properties")
@ConfigurationProperties(prefix = "xx.xyz") //配置文件属性统一前缀
@Data
public class HuanXinConfig {
private String url;
private String name;
private String clientId;
private String clientSecret;
}
最后
以上就是鲜艳外套最近收集整理的关于SpringBoot读取properties文件中的值SpringBoot读取properties文件中的值的全部内容,更多相关SpringBoot读取properties文件中内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复