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

Error injecting @Repository interface using generics #9751

Open
agustin-tecso opened this issue Jul 26, 2023 · 0 comments · Fixed by #9752
Open

Error injecting @Repository interface using generics #9751

agustin-tecso opened this issue Jul 26, 2023 · 0 comments · Fixed by #9752

Comments

@agustin-tecso
Copy link

Expected Behavior

When I have a Interface annotated with @repository and the interface is declared using generics types, the injection must succeed like in previous versions of the framework. This work in version 3.9.4

Actual Behaviour

In Micronaut 4.0.1, the injection fails with the error:

Failed to inject value for field [] of class: ...

Message: No bean of type [coop.tecso.AInterface<java.lang.String,java.lang.String>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Path Taken: InjectionTest.cacheString
io.micronaut.context.exceptions.DependencyInjectionException: Failed to inject value for field [cacheString] of class: coop.tecso.InjectionTest

Message: No bean of type [coop.tecso.AInterface<java.lang.String,java.lang.String>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Path Taken: InjectionTest.cacheString

Steps To Reproduce

  1. Clone the project
  2. run the test. In the root of the project execute ./gradlew test
  3. The test fail. If you change the version to Micronaut 3.9.4 the test will work.

Environment Information

Manjaro Linux.
OpenJDK 17

Example Application

https://github.com/agustin-tecso/micronaut-error

Version

4.0.1

@dstepanov dstepanov transferred this issue from micronaut-projects/micronaut-data Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant