INT 활성화를 반환하고 ForgotPassword 잘 작동 int로하지만, 문자열 변수 내가 appSettings는 정적 클래스@PropertySource @Value 정적 문자열) 도착 널
@PropertySource("classpath:appSettings.properties")
public class AppSettings {
@Value("${Activation}")
private static int Activation;
@Value("${ForgotPassword}")
private static int ForgotPassword;
@Value("${CryptoSplit}")
private static String CryptoSplit;
@Value("${CryptoKey}")
private static String CryptoKey;
public static String getCryptoSplit() {
return CryptoSplit;
}
public static String getCryptoKey() {
return CryptoKey;
}
public static int getActivation() {
return Activation;
}
public static int getForgotPassword() {
return ForgotPassword;
}
}
.properties의
Activation=0
ForgotPassword=1
CryptoSplit=:OSK:
CryptoKey=TheBestSecretKey
쓰기 setter 메소드를 대신 setter 메소드에 값 '@'넣어 변수를 넣는 것 – pvpkiran
'static '필드/메소드에'@ Value'를 자동으로 연결하거나 사용할 수 없습니다. –
값 주석을 사용하여 정적 변수를 정의하려면 [이 답변] (https://stackoverflow.com/a/45192557/3493036)을 살펴보십시오. – Patrick