配置类
package com.xxx.framework.xxx.common;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class WxConstants {
public static String appid;
public static String secret;
@Value("${wechat.appid}")
public void setAppid(String wxAppid) {
appid = wxAppid;
}
@Value("${wechat.secret}")
public void setSecret(String wxSecret) {
secret = wxSecret;
}
}
方法直接使用
WxConstants.appid