spring與springboot中,如何在static方法里使用自動注入的屬性
第一步:寫注解@Component 使當前類成為一個bean對象。(@Controller,@service都行) 第二步:寫個static的變量 第三步:寫個@PostConstruct注解注解 ...
第一步:寫注解@Component 使當前類成為一個bean對象。(@Controller,@service都行) 第二步:寫個static的變量 第三步:寫個@PostConstruct注解注解 ...
springboot用@Autowired和@PostConstruct注解把config配置讀取到bean變成靜態方法 不用web,運行的方法implements Comman ...