解决autowaired注入时机问题
package com.haiyisoft.loveLifeWeb.config;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class UrlConfigUtil {
private static String loveLifeService;
private static String loveLifeRightService;
@Value("${loveLifeService}")
private String loveLifeService1;
@Value("${loveLifeRightService}")
private String loveLifeRightService1;
public static String getLoveLifeService() {
return loveLifeService;
}
public static String getloveLifeRightService() {
return loveLifeRightService;
}
@PostConstruct
public void getApiToken() {
loveLifeService = this.loveLifeService1;
loveLifeRightService=this.loveLifeRightService1;
}
}