Hi,
found an issue with @EnableAxonAutoConfiguration. For beans that have event handlers and use constructor injection with component scanning, an exception is thrown.
It is easy to reproduce. I created a spring boot app with jpa, web, hsqldb and lombok and then added the following code.
package com.example;
import org.axonframework.spring.config.EnableAxonAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan
@EnableAxonAutoConfiguration
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
package com.example;
import org.springframework.stereotype.Component;
import javax.persistence.EntityManager;
@Component
public class SampleBean {
public SampleBean(EntityManager em) {
System.out.println("--->" + em);
}
//@EventHandler uncomment this to break app
public void on(String event) {
}
}
Uncommenting @EventHandler gives the following error
Caused by: java.lang.NoSuchMethodException: com.example.SampleBean.<init>()
Is this a bug or should I use another Configuration setup?