Summary

We now have a complete understanding of producers and their various aspects within CDI development for our applications. We covered what scope is assigned to a bean instance created from a producer and how to inject instances of beans into our producers; so that we may create producers that take advantage of runtime decision making about the exact bean instance that needs to be returned. We also learnt how to prevent unintended scope problems of bean instances being used in a producer by requesting a dependent instance from Weld with @New and creating a method to clean up any resources that may remain open when a bean instance is destroyed by Weld.

Get JBoss Weld CDI for Java Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.