If 'errorChannel' bean has a custom definition, for example of amqp PointToPointSubscribableAmqpChannel, then an application fails to start because of thrown java.lang.ClassCastException happens in BeanPostProcessor globalErrorChannelCustomizer in BindingServiceConfiguration auto-configuration.
Actual behavior: globalErrorChannelCustomizer doesn't verify if errorChannel bean is of PublishSubscribeChannel before casting object:
@Bean
public static BeanPostProcessor globalErrorChannelCustomizer() {
return new BeanPostProcessor() {
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if ("errorChannel".equals(beanName)) {
((PublishSubscribeChannel) bean).setIgnoreFailures(true);
}
return bean;
}
};
}
Expected behavior: errorChannel object type must be verified before doing any cast on it to avoid java.lang.ClassCastException on application startup.
Version of the framework: tested on v.3.2.10, but this unsafe BeanPostProcessor declaration exist in main.