Enterprise Java

Quarkus’ additional (non-standard) CDI features

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

Published on Java Code Geeks with permission by Sebastian Daschner, partner at our JCG program. See the original article here: Quarkus’ additional (non-standard) CDI features (Video)

Opinions expressed by Java Code Geeks contributors are their own.

Sebastian Daschner

Sebastian Daschner is a self-employed Java consultant and trainer. He is the author of the book 'Architecting Modern Java EE Applications'. Sebastian is a Java Champion, Oracle Developer Champion and JavaOne Rockstar.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button