[axonframework] Exception thrown when using Axon + Spring + Annotation configuration

Hi Samuele,

the problem is a ClassCastException in some Spring generated stub. Do you have a bean called mongoTemplate defined in another location? It looks like another bean than the expected one is injected.



Thank you Allard, I have already resolved the error by myself. I tried to delete the message from the board, but you were too fast :smiley: :smiley:

How did you fix the error? Could you please help me with it. I am getting a similar error.


make sure you’re using the correct class for MongoTemplate. Also make sure there are no two beans with the same name. In Java-Config, the method name of the @Bean annotated method is the name of the declared bean (unless explicitly defined as a parameter with @Bean). If you have two methods with the same name, you can get these types of exceptions. Renaming one of them will do the trick.