CDI (Context and dependency injection) is a great specification introduced in the JEE6 that offers a lot of resources. One of them is the Producer methods, and we’ll be talking about it in this post.
CDI Producer can be used in some scenarios, such as:
- Making Non-CDI beans eligible to be injected into other CDI beans. You may be using some library that doesn’t expose their beans via CDI but you want to inject them in your CDI beans by convenience.
- You have a bean that requires a constructor with some argument.