springboot用@Autowired和@PostConstruct注解把config配置读取到bean变成静态方法 @SpringBootApplication public class SendEmailApplication implements CommandLineRunner{ public static Configs conf; @Autowired private Configs conf2; @PostConstruct public void initconf() {
先看下@PostConstruct的注解 * The PostConstruct annotation is used on a method that needs to be executed * after dependency injection is done to perform any initialization. This * method MUST be invoked before the class is put into service. This * annotatio
@PostConstruct注解使用 @PostConstructApi使用说明 The PostConstruct annotation is used on a method that needs to be executed after dependency injection is done to perform any initialization. This method MUST be invoked before the class is put into service. Th