解决方法
1.成员变量添加注解@Autowired
2.然后在任务类的execute方法中添加以下代码,自动注入成员变量实现类
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
问题原因: 有待深入验证。说的比较多的是Quartz与Spring的context不同,父context无法访问子context中的Bean。
解决方法
1.成员变量添加注解@Autowired
2.然后在任务类的execute方法中添加以下代码,自动注入成员变量实现类
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
问题原因: 有待深入验证。说的比较多的是Quartz与Spring的context不同,父context无法访问子context中的Bean。
本文标题:[转载]解决Spring+Quartz无法自动注入Service
本文链接:https://www.haomeiwen.com/subject/rhkkgttx.html
网友评论