BATCH-2169: Added warning message for when users use java config with @StepScope
This commit is contained in:
@@ -24,6 +24,8 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
@@ -65,6 +67,8 @@ import org.springframework.util.Assert;
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract class AbstractListenerFactoryBean implements FactoryBean, InitializingBean {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(AbstractListenerFactoryBean.class);
|
||||
|
||||
private Object delegate;
|
||||
|
||||
private Map<String, String> metaDataMap;
|
||||
@@ -215,6 +219,10 @@ public abstract class AbstractListenerFactoryBean implements FactoryBean, Initia
|
||||
&& listenerType.isAssignableFrom(targetSource.getTargetClass())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(targetSource != null && targetSource.getTargetClass() != null && targetSource.getTargetClass().isInterface()) {
|
||||
logger.warn(String.format("%s is an interface. The implementing class will not be queried for annotation based listener configurations. If using @StepScope on a @Bean method, be sure to return the implementing class so listner annotations can be used.", targetSource.getTargetClass().getName()));
|
||||
}
|
||||
}
|
||||
for (ListenerMetaData metaData : metaDataValues) {
|
||||
if (MethodInvokerUtils.getMethodInvokerByAnnotation(metaData.getAnnotation(), target) != null) {
|
||||
|
||||
Reference in New Issue
Block a user