美文网首页
[转载]解决Spring+Quartz无法自动注入Service

[转载]解决Spring+Quartz无法自动注入Service

作者: zxk175 | 来源:发表于2017-03-02 16:16 被阅读191次

    解决方法

    1.成员变量添加注解@Autowired

    2.然后在任务类的execute方法中添加以下代码,自动注入成员变量实现类

    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    

    问题原因: 有待深入验证。说的比较多的是Quartz与Spring的context不同,父context无法访问子context中的Bean。

    引用地址

    相关文章

      网友评论

          本文标题:[转载]解决Spring+Quartz无法自动注入Service

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