|
|
@ -27,6 +27,8 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(XxlJobSpringExecutor.class);
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(XxlJobSpringExecutor.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------- start / stop ----------------------
|
|
|
|
|
|
|
|
|
|
|
|
// start
|
|
|
|
// start
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void afterSingletonsInstantiated() {
|
|
|
|
public void afterSingletonsInstantiated() {
|
|
|
@ -82,9 +84,14 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// init job handler from method
|
|
|
|
// init job handler from method
|
|
|
|
String[] beanDefinitionNames = applicationContext.getBeanNamesForType(Object.class, false, true);
|
|
|
|
String[] beanDefinitionNames = applicationContext.getBeanNamesForType(Object.class, false, false); // allowEagerInit=false, avoid early initialization
|
|
|
|
for (String beanDefinitionName : beanDefinitionNames) {
|
|
|
|
for (String beanDefinitionName : beanDefinitionNames) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// filter system bean
|
|
|
|
|
|
|
|
if (isSystemBean(beanDefinitionName)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// get bean
|
|
|
|
// get bean
|
|
|
|
Object bean = null;
|
|
|
|
Object bean = null;
|
|
|
|
Lazy onBean = applicationContext.findAnnotationOnBean(beanDefinitionName, Lazy.class);
|
|
|
|
Lazy onBean = applicationContext.findAnnotationOnBean(beanDefinitionName, Lazy.class);
|
|
|
@ -123,6 +130,13 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if system bean, not job bean
|
|
|
|
|
|
|
|
private boolean isSystemBean(String beanClassName) {
|
|
|
|
|
|
|
|
return beanClassName.startsWith("org.springframework")
|
|
|
|
|
|
|
|
|| beanClassName.startsWith("spring.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------- applicationContext ----------------------
|
|
|
|
// ---------------------- applicationContext ----------------------
|
|
|
|
private static ApplicationContext applicationContext;
|
|
|
|
private static ApplicationContext applicationContext;
|
|
|
|
|
|
|
|
|
|
|
|