© Luqman Saeed 2020
L. SaeedIntroducing Jakarta EE CDIhttps://doi.org/10.1007/978-1-4842-5642-8_9

9. CDI Stereotypes

Luqman Saeed1 
(1)
Accra, Ghana
 

CDI stereotypes are an API construct that help you group together similar architectural patterns into one annotation. In the restaurant application you learned about in Chapter 8, there is a class named QueryService that you need to transform into a transactional, logged, request scoped bean to carry out a query service in the data layer.

Now assume this requirement will apply to other beans as well. What this means is that QueryService would look like the following.
../images/493447_1_En_9_Chapter/493447_1_En_9_Figa_HTML.jpg

Lines 1-3 use the @RequestScoped, @Transactional ...

Get Introducing Jakarta EE CDI: Contexts and Dependency Injection for Enterprise Java Development 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.