如何在静态工具类中注入service方法

2018-03-28  本文已影响0人  宁酱吖

@Component

public class ParseElementUtil {

@Autowired

  private CaserecordService caserecordService;

  private static ParseElement UtilparseElementUtil;

  @PostConstruct

  public void init() {

    parseElementUtil =this;

    parseElementUtil.caserecordService =this.caserecordService;

  }

}

@PostConstruct @Autowired @Component 这三个注解是重要的组成

上一篇下一篇

猜你喜欢

热点阅读