|
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.DisposableBean;
|
|
|
import org.springframework.beans.factory.SmartInitializingSingleton;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.context.ApplicationContextAware;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.core.MethodIntrospector;
|
|
|
import org.springframework.core.annotation.AnnotatedElementUtils;
|
|
|
|
|
@@ -84,7 +85,14 @@ public class XxlJobSpringExecutor extends XxlJobExecutor implements ApplicationC
|
|
|
// init job handler from method
|
|
|
String[] beanDefinitionNames = applicationContext.getBeanNamesForType(Object.class, false, true);
|
|
|
for (String beanDefinitionName : beanDefinitionNames) {
|
|
|
- Object bean = applicationContext.getBean(beanDefinitionName);
|
|
|
+ Object bean = null;
|
|
|
+ Lazy onBean = applicationContext.findAnnotationOnBean(beanDefinitionName, Lazy.class);
|
|
|
+ if (onBean!=null){
|
|
|
+ logger.debug("xxl-job skip @Lazy Bean:{}",beanDefinitionName);
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ bean = applicationContext.getBean(beanDefinitionName);
|
|
|
+ }
|
|
|
|
|
|
Map<Method, XxlJob> annotatedMethods = null; // referred to :org.springframework.context.event.EventListenerMethodProcessor.processBean
|
|
|
try {
|