Home > Mobile >  What are the possible causes of Duplicate bean name in Spring 5.3.18 other than two beans with the s
What are the possible causes of Duplicate bean name in Spring 5.3.18 other than two beans with the s

Time:10-27

I'm receiving this error after building my war and deploying it to a tomcat server:

Error creating bean with name 'dwrController': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Duplicate name found. See logs for details.

However, this code inside my servlet.xml is the only place in the application where "dwrController" is named. There is no duplicate bean anywhere.

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
     xsi:schemaLocation="http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans.xsd 
      http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">

     <dwr:controller id="dwrController" debug="true" />
</beans:beans>

I'm pretty new to spring, so I'm not entirely sure of what is going on under the hood (since assumingly somehow a second bean of the same name is being created without code on startup) and what the possible causes of this might be, which makes it difficult to debug.

CodePudding user response:

You started a thread for @Async, and another thread for CompletableFuture, because the CompletableFuture uses the ForkJoinPool thread pool internally, and your log is also output in the CompletableFuture thread, so That's not a problem

CodePudding user response:

may be you enabled auto-scan...

  • Related