I ran into a situation where MessageHandlerLookup that is loaded as part of org.axonframework.springboot.autoconfig.InfraConfiguration is messing my LoadTimeWeaver logic as a number of Java Classes are not weaved properly. Specifically this method below is causing the issues.
Wonder if anyone ran into the situation and if there is an easy workaround/fix for this.
Thank you!
Oleg
@Override
public void postProcessBeanFactory(@Nonnull ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (!(beanFactory instanceof BeanDefinitionRegistry)) {
logger.warn("Given bean factory is not a BeanDefinitionRegistry. Cannot auto-configure message handlers");
return;
}
for (MessageHandlerConfigurer.Type value : MessageHandlerConfigurer.Type.values()) {
String configurerBeanName = "MessageHandlerConfigurer$$Axon$$" + value.name();
if (beanFactory.containsBeanDefinition(configurerBeanName)) {
logger.info("Message handler configurer already available. Skipping configuration");
break;
}
List<String> found = messageHandlerBeans(value.getMessageType(), beanFactory);
if (!found.isEmpty()) {
List<String> sortedFound = sortByOrder(found, beanFactory);
AbstractBeanDefinition beanDefinition =
BeanDefinitionBuilder.genericBeanDefinition(MessageHandlerConfigurer.class)
.addConstructorArgValue(value.name())
.addConstructorArgValue(sortedFound)
.getBeanDefinition();
((BeanDefinitionRegistry) beanFactory).registerBeanDefinition(configurerBeanName, beanDefinition);
}
}
}