* 上一篇讲了配置文件的自动装配,这一片讲一下静态装配 import lombok.Data; import
org.springframework.beans.factory.annotation.Value; import
org.springframework.boot.context.properties.ConfigurationProperties; import
org.springframework.stereotype.Component; @Component
@ConfigurationProperties(prefix = "app") @Data public class CustomProperties {
public static String appid; public static String appkey; public static String
secretkey; @Value("${app.appid}") public void setAppid(String appid) {
CustomProperties.appid = appid; } @Value("${app.appkey}") public void
setAppkey(String appkey) { CustomProperties.appkey = appkey; }
@Value("${app.secretkey}") public void setSecretkey(String secretkey) {
CustomProperties.secretkey = secretkey; } }

技术
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信