直接上代码
方式1:
//可以换成@Configuration,与@Inject配合使用
@Componentpublic
class XXUtils {
//可以换成@Inject
@Resource
private XXXProperties xxxPropertiesAutowired;
private static XXXProperties xxxProperties;
@PostConstruct
public void init() {
this.xxxPropertiesAutowired = xxxProperties;
}
}
@Component
public class UrlUtil {private static RRJConfig rrjConfig;
@Autowired
public void setRRJConfig(RRJConfig rRJConfig) {
UrlUtil.rrjConfig = rRJConfig;
}