Quarkus' additional (non-standard) CDI features (Video)wednesday, april 01, 2020
Quarkus supports CDI (Contexts and Dependency Injection) 2.0, but not all of it, only the most common features. However, Quarkus does include some non-standard features that can come in quite handy to developers which I want to show in the following video.
Whether or not you’re familiar with CDI, if you use Quarkus you should have a look at the guide for Contexts and Dependency Injection which nicely explains the ins and outs of Quarkus' dependency injection.
For Quarkus' particularities with CDI, the most important takeaways that I see are:
Only annotated bean mode is supported (annotate your beans with scopes)
Unused beans might be removed at build time
Producer methods and fields, observer methods, and scheduled methods are still considered
Prefer package-private field injection or constructor injection over private field injection
Injection points might not be instatiated right away but lazily, only once used, depending on the scope
Found the post useful? Subscribe to my newsletter for more free content, tips and tricks on IT & Java:
All opinions are my own and do not reflect those of my employer or colleagues.