常量的使用方式
@Component
public class ServiceEnvConstants {
/** 公钥-从详情页面获取 */
public static String publicKey;
@Value("${public_key}")
public void setPublicKey(String publicKey) {
ServiceEnvConstants.publicKey = publicKey;
}
/** 字符编码-传递给数据编码 */
public static final String CHARSET = "UTF-8";
}
Spring在初始化有几种方式,注意初始化先后顺序

浙公网安备 33010602011771号