0

I have to use spring-boot-devtools & axon in spring-boot application. I have included both of them in pom.xml. It is not working. Application fails to start.

I have tried to run application without using spring-boot-devtools then it works perfectly as expected but not with spring-boot-devtools. I have read document of axon on https://docs.axoniq.io/reference-guide/setting-up/spring-boot where it is suggested not to use devtools with axon. I also refereed issue https://github.com/AxonFramework/AxonFramework/issues/976 where it is stated, removing the devtools dependency did the trick. I don't want to remove devtools as it is useful in development mode. Pom.xml content:

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-devtools</artifactId>
   <optional>true</optional>
</dependency>

<dependency> 
    <groupId>org.axonframework</groupId> 
    <artifactId>axon-spring-boot-starter</artifactId> 
    <version>4.0.3</version>
 </dependency> 

I expect application to start but got error :

Description: The bean 'commandBus', defined in class path resource [org/axonframework/springboot/autoconfig/AxonAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/axonframework/springboot/autoconfig/AxonServerAutoConfiguration.class] and overriding is disabled.

Action: Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

I have tried spring.main.allow-bean-definition-overriding=true but not working.

  • As I would say is clear from the issue on Axon Frameworks GitHub page, it is recommended **not** to use Spring Boot DevTools in conjunction with Axon, as there is no guarantee either of them will work sufficiently. I'd thus recommended to either resolve the issue for the framework, or, and this might sound a little harsh, stop using `spring-boot-devtools`. – Steven Sep 04 '19 at 08:19
  • Mr Seagal, is that you? :P Im having the same issue, Axon wont play with dev tools ;-( – Dimitar Vukman Apr 14 '20 at 15:44

0 Answers0