美文网首页
java中工具类的静态方法调用注入的service解决方案

java中工具类的静态方法调用注入的service解决方案

作者: 李彬燊666 | 来源:发表于2020-01-04 10:18 被阅读0次

1:在工具上添加@service 注解

2:

@Resource

private IFileModelsService fileService;

@Resource

private IKeyWordService keyWordService;

private static FTPUtils  ftpUtils;

@PostConstruct

public void init(){

    ftpUtils = this;

    ftpUtils.fileService = this.fileService;

    ftpUtils.keyWordService = this.keyWordService;

}

相关文章

网友评论

      本文标题:java中工具类的静态方法调用注入的service解决方案

      本文链接:https://www.haomeiwen.com/subject/sysxactx.html