Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring-boot micronaut-data application fails with Multiple possible bean candidate exception #383

Closed
timyates opened this issue Jan 4, 2023 · 2 comments
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@timyates
Copy link
Contributor

timyates commented Jan 4, 2023

We have a guide for using micronaut-data along with spring-boot.

https://github.com/micronaut-projects/micronaut-guides/tree/master/guides/spring-boot-micronaut-data

Since the release of Micronaut 3.8.0 (which references micronaut-spring-boot-starter:4.4.0 in the BOM), this guide fails to build with:

io.micronaut.context.exceptions.NonUniqueBeanException: Multiple possible bean candidates found: [io.micronaut.data.jdbc.operations.DefaultJdbcRepositoryOperations, io.micronaut.data.jdbc.operations.DefaultJdbcRepositoryOperations]
        at io.micronaut.context.DefaultBeanContext.findConcreteCandidate(DefaultBeanContext.java:2472) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultApplicationContext.findConcreteCandidate(DefaultApplicationContext.java:488) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.lastChanceResolve(DefaultBeanContext.java:3249) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.findConcreteCandidateNoCache(DefaultBeanContext.java:3140) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.findConcreteCandidate(DefaultBeanContext.java:3058) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.findBeanDefinition(DefaultBeanContext.java:788) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2790) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1617) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:867) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:859) ~[micronaut-inject-3.8.0.jar:3.8.0]
        at io.micronaut.data.runtime.operations.DefaultRepositoryOperationsRegistry.provide(DefaultRepositoryOperationsRegistry.java:53) ~[micronaut-data-runtime-3.9.1.jar:3.9.1]
        at io.micronaut.data.runtime.intercept.DataInterceptorResolver.findInterceptor(DataInterceptorResolver.java:111) ~[micronaut-data-runtime-3.9.1.jar:3.9.1]
        at io.micronaut.data.runtime.intercept.DataInterceptorResolver.lambda$resolve$2(DataInterceptorResolver.java:92) ~[micronaut-data-runtime-3.9.1.jar:3.9.1]
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) ~[na:na]

https://ge.micronaut.io/s/ggpqezvafcamc/console-log?task=:springBootMicronautDataRunTestScript

If I change the generated project to use

    implementation("io.micronaut.spring:micronaut-spring-boot-starter:4.3.1")

Then it works as expected, so it must be something introduced in 4.4.0

Steps to reproduce

  • Check out the micronaut-guides project
  • Run ./gradlew :springBootMicronautDataRunTestScript to see the failure
  • Open build/code/spring-boot-micronaut-data/spring-boot-micronaut-data-gradle-java in intellij
  • Change the build file to use 4.3.1 implementation("io.micronaut.spring:micronaut-spring-boot-starter:4.3.1")
  • The tests should pass
@timyates timyates added the type: bug Something isn't working label Jan 4, 2023
@timyates timyates added this to the 4.4.1 milestone Jan 4, 2023
timyates added a commit to micronaut-projects/micronaut-guides that referenced this issue Jan 5, 2023
@sdelamo
Copy link
Contributor

sdelamo commented Jan 11, 2023

@timyates can this be closed via #384 ?

@sdelamo sdelamo moved this to In Review in 3.8.1 Release Jan 11, 2023
@timyates
Copy link
Contributor Author

Fixed via #384

@github-project-automation github-project-automation bot moved this from In Review to Done in 3.8.1 Release Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants