SpringBoot使用@Value给静态变量注入值 静态变量的获取方法
程序员文章站
2022-03-23 23:21:21
...
@Component
public class ProxyUtils {
public static String PROXY_HOST;
public static String PROXY_SECRET;
public static String PROXY_OA_SERVER_HOST;
@Value("${proxy.host}")
public void proxyHost(String proxyhostname){
PROXY_HOST=proxyhostname;
}
@Value("${secret.key}")
public void secretKey(String secretkey){
PROXY_SECRET=secretkey;
}
参考文章:https://blog.csdn.net/mononoke111/article/details/81088472