quarkus: Mocked bean created via method is not injected in another bean

Describe the bug

Beans which are created via @Produces api are not injected in others beans fields. It works fine if I annotate bean with @ApplicationScope instead of using @Produces.

Expected behavior

Mocked bean in passed to other beans.

Actual behavior

Real bean in passed to other beans.

How to Reproduce?

example repo: https://github.com/vadim-hleif/test-quarkus-mocking

Output of uname -a or ver

Darwin Vadims-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk 17.0.3 2022-04-19 LTS OpenJDK Runtime Environment Zulu17.34+19-CA (build 17.0.3+7-LTS) OpenJDK 64-Bit Server VM Zulu17.34+19-CA (build 17.0.3+7-LTS, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.10.2

Build tool (ie. output of mvnw --version or gradlew --version)

7.4.2

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (13 by maintainers)

Commits related to this issue

Most upvoted comments

https://github.com/quarkusio/quarkus/pull/27179 should take care of the problem

I reopened the issue since this an actual problem, but so far I haven’t been able to pinpoint the root cause.

I just figured out why we are seeing different results. This file has the wrong casing, which a Mac doesn’t matter, but in Linux does…

But making all classes as open resolves this issue, sorry, you are right.