0

I have read and I have understood that JPA, JSF, CDI are only specifications. Such as:

  • JPA - [Hibernate, Toplink], JSR-000338
  • CDI - [Spring - Google Guice, PicoContainer], JSR299
  • JSF - [Primefaces, IceFaces, RichFaces], JSR-000314

So, if they are only specification in a paper, why the packages says, "javax.persistence...", “javax.faces."?

I think that Oracle says: Here is this paper where are the rules. If you want to implement it you must to use my package name ("javax.persistence...", " javax.faces."), and as pay, you can add more features and you will can to put your own package for the extended features?

Other thing, if I study the specifications (jpa, cdi, jsf), Will I be able to use whatever framework? Or even, to construct my software without them?

Please explain me that.

Best regards.

1 Answers1

3

First of all, neither Spring, nor Guice (and not PicoContainer either, AFAIK) are CDI implementations. JBoss Weld is a CDI implementation.

Second. The specification is not just a paper. It's also a set of interfaces and classes that every implementation must correctly implement or extend or which even contain core functionalities that don't depend on the implementation (see Persistence, for example). Those interfaces and classes are the ones that are in the javax package. They're part of the specification itself, and implementations may not modify them.

The idea of a standard is indeed that by relying on the rules described in the specifications, you should be able to use whatever framework implementing the specifications. Beware, though, that some parts are sometimes left unspecified, and that implementations, even without bugs, can do some things differently.

Implementing your software without an implementation would, theoretically, be possible, as long as the user of your software chooses the implementation it wants. But that is extremely unrealistic: you will have to test your software and thus choose an implementation for your tests. And if you plan on supporting several implementations of the specification, you will have to test your software wilth all of them, and even probably need to make adjustments.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255