Closed beatngu13 closed 9 months ago
Hello @beatngu13,
your code makes sense except you are missing a bean defining annotation on the implementing bean (MyServiceImpl
).
Just add @Dependent
(or other scope of your preference) on it and it will work.
The reason you need this is because default discovery mode (since CDI 4.0) is annotated
; by using @AddPackages(...)
you are telling Weld to scan those packages for beans but it will still only discover those that have bean defining annotations.
I am going to close this issue but if you think your question isn't answered, feel free to reopen or just keep the discussion going.
@manovotn this indeed works – thanks a lot for the prompt answer and great explanation! 🙏
I'm trying out the CDI decorator pattern, here's the corresponding commit:
https://github.com/beatngu13/playground/commit/7873516adddd2402a45c14aab57ce97b327c4141
Unfortunately, the (currently
@Disabled
) test fails with:I based my setup on this example and wonder what am I doing wrong?