MessagingAnnotationPostProcessor avoids null target class (INT-239).
This commit is contained in:
@@ -233,8 +233,8 @@ public abstract class AbstractMessageChannel implements MessageChannel, BeanName
|
||||
}
|
||||
|
||||
public boolean preReceive(MessageChannel channel) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("preReceive on channel '" + channel + "'");
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("preReceive on channel '" + channel + "'");
|
||||
}
|
||||
for (ChannelInterceptor interceptor : interceptors) {
|
||||
if (!interceptor.preReceive(channel)) {
|
||||
@@ -245,9 +245,12 @@ public abstract class AbstractMessageChannel implements MessageChannel, BeanName
|
||||
}
|
||||
|
||||
public void postReceive(Message<?> message, MessageChannel channel) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (message != null && logger.isDebugEnabled()) {
|
||||
logger.debug("postReceive on channel '" + channel + "', message: " + message);
|
||||
}
|
||||
else if (logger.isTraceEnabled()) {
|
||||
logger.trace("postReceive on channel '" + channel + "', message is null");
|
||||
}
|
||||
for (ChannelInterceptor interceptor : interceptors) {
|
||||
interceptor.postReceive(message, channel);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Init
|
||||
|
||||
private volatile ClassLoader beanClassLoader;
|
||||
|
||||
private Map<Class<?>, AnnotationMethodPostProcessor> postProcessors = new HashMap<Class<?>, AnnotationMethodPostProcessor>();
|
||||
private final Map<Class<?>, AnnotationMethodPostProcessor> postProcessors =
|
||||
new HashMap<Class<?>, AnnotationMethodPostProcessor>();
|
||||
|
||||
|
||||
public MessagingAnnotationPostProcessor(MessageBus messageBus) {
|
||||
@@ -62,10 +63,6 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Init
|
||||
this.beanClassLoader = beanClassLoader;
|
||||
}
|
||||
|
||||
protected MessageBus getMessageBus() {
|
||||
return this.messageBus;
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() {
|
||||
this.postProcessors.put(MessageHandler.class, new HandlerAnnotationPostProcessor(this.messageBus, this.beanClassLoader));
|
||||
this.postProcessors.put(Source.class, new SourceAnnotationPostProcessor(this.messageBus, this.beanClassLoader));
|
||||
@@ -101,8 +98,9 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Init
|
||||
return bean;
|
||||
}
|
||||
|
||||
protected Class<?> getBeanClass(Object bean) {
|
||||
return AopUtils.getTargetClass(bean);
|
||||
private Class<?> getBeanClass(Object bean) {
|
||||
Class<?> targetClass = AopUtils.getTargetClass(bean);
|
||||
return (targetClass != null) ? targetClass : bean.getClass();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user