3. What Is a Reference Implementation? – Introducing Jakarta EE CDI: Contexts and Dependency Injection for Enterprise Java Development

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

3. What Is a Reference Implementation?

Luqman Saeed
Accra, Ghana
In the previous chapter, you learned what a JSR is. Recall that a JSR is an abstract request to the JCP that contains proposed additions to the Java technology platform.
Because it is abstract, you cannot run it. A JSR needs to have some form of implementation, or concrete realization, to be useful to end developers. That is where the concept of reference implementation comes in.
Every JSR must have a reference implementation, which is a concrete implementation of the specification contained in the JSR document. This is a requirement of the JCP. Every single JSR has a reference implementation that is freely available and bundled with the application servers.
A JSR also has a Technology Compatibility Kit (TCK), which is “a suite of tests that at least nominally checks a particular alleged implementation of a Java Specification Request (JSR) for compliance.”1
A TCK is used to test a JSR implementation for compliance with the spec. That is part of why Java EE is said to be a standardized set of specifications.
This rigorous process also ensures the quality of the APIs that are derived from the JSR document. Some popular reference implementations (RIs) of JSRs include the following:
  • JSR 380 (Bean Validation 2.0) – Hibernate Validator 6
  • JSR 367 (JSON-B Binding) – Eclipse Yasson 1.0
  • JSR 370 (JAX-RS 2.1) – Jersey
  • JSR 365 (CDI 2.0) – WELD 3.0
These are some of the new and more popular JSRs and their respective reference implementations. Most of these reference implementations are bundled with application servers, which is the subject of the next chapter.