I have a problem while scheduling a task into an application scoped bean using spring 4.3.1. My code is something like this one:
@Component
@ApplicationScope
public class MyClassImpl implements MyClass {
@Scheduled(fixedDelayString = "60000")
@Transactional
public void method() {
do something...
}
}
The scheduled method is runned twice. I debugged application context creation and it seems that the bean is loaded only one time as expected. Do somebody has some suggestions?
I added a BeanPostProcessor and I noticed that spring framework instantiate 2 beans one named MyClassImpl and one named scopedTarget.MyClassImpl any idea on how to avoid this behaviour?
解决了创建一个新类的问题,该类未实现任何包含@Scheduled方法的接口(带注释的@Component )。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.