SpringDoc bean name conflict error
miriyalajanardhan opened this issue · 1 comments
I tried to upgrade to spring boot 3.0.0
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>15.0.0</version>
</dependency>
The problem is they both have a Bean with the name 'objectMapperProvider'.
Description:
The bean 'objectMapperProvider', defined in class path resource [org/springdoc/core/configuration/SpringDocConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [graphql/kickstart/autoconfigure/web/servlet/GraphQLWebAutoConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
This is not a bug of this project. This is simply a naming conflict. This library has marked the creation of the ObjectMapperProvider as @ConditionalOnMissingBean. Sounds like that springdoc library does not use such an annotation and therefore the conflict occurs. So you should check with the springdoc library if it's possible to add that @ConditionalOnMissingBean annotation there too, since they're the one actually causing this error. In the meantime you can execute the action they suggest by allowing bean definition overriding.