cdi-468 Split Spec doc to introduce CDI Lite#470
Conversation
|
I still have some modifications to add before a first review |
I am aware of this but I still got to glance at it and thought I might leave some notes for you if you don't mind :) FTR any chapter numbers I mention below are from your snapshot.
|
manovotn
left a comment
There was a problem hiding this comment.
Added some comments - I will send a PR against your branch with the suggestions I am making here (majority of them).
We also need a placeholder chapter for bean archives (packaging and deployment basically) in Lite which is TBD but we mustn't forget about it.
There are few more point that my PR won't address and that I wanted to bring attention to:
- Specialization section should IMO be under
Fullaccording to what we agreed on - CDI Full has tons on very small chapters, most of which deal with limitations and deployment exceptions for decorators (and other single feature related topics). I was thinking if it wouldn't be more readable if we were to just create, for example, a decorator chapter and list all the limitations there?
Modularityin Lite currently speaks about explicit bean archives and enabling alternatives per archive. This is IMO wrong and should be mostly moved into Full. WDYT?- Lite needs a section about
Packing and deployment. It will re-use part of the text from Full (such as how discovery works for implicit) but even with just
|
@antoinesd I sent the above suggested changes as a PR to your repo - antoinesd#6 |
|
We will also need to state that we don't support |
Signed-off-by: antoinesd <antoine@sabot-durand.net>
additional split Signed-off-by: antoinesd <antoine@sabot-durand.net>
…Modularity paragraph.
|
Addressed other comments present here. Also rebased onto master which contained some doc changes causing clashes. Moved specialization under Full while leaving inheritance rules in Lite. If you find anything unclear or discover any typos, misplaces chapter etc, let me know and I'll fix that. |
…ions into one chapter. Add multiple notions of Full - specific rules cak to original chapters and note that this behaviour is not in Lite.
|
I've added a commit that tries to make the What I've done:
This drastically reduces the amount of paragraphs and sections needed under |
…upport inteception declaring with bindings.
|
Added a commit splitting interceptor chapter into Lite and Full to separate things such as per-archive activation. I have also added a statement into Lite section that eliminates support of |
|
I did a comprehensive review of the entire spec and made quite a bit of changes, mostly related to the Lite/Full split. I pushed a commit with all those changes. I have also liberally (yet carefully) added |
|
For the record, I also maintain a set of HTML diffs of the spec here: https://ladicek.github.io/cdi-spec/ I'm going to add a diff for my changes later today -- generating the diff takes some time. |
| Note that to ensure compatibility with other Jakarta Dependency Injection implementations, all pseudo-scope annotations except `@Dependent` *are not* bean defining annotations. | ||
| However, a stereotype annotation including a pseudo-scope annotation *is* a bean defining annotation. | ||
|
|
||
| // TODO we might be able to make `@Singleton` a bean defining annotation in Lite? depending on how we decide on the beans.xml thing |
There was a problem hiding this comment.
I don't think you can do that. Because in Full it cannot be bean defining annotation and that would create inconsistency between Lite and Full.
|
|
||
| A bean may declare zero, one or multiple stereotypes. | ||
|
|
||
| // TODO how about we finally allowed declaring `@Priority` on stereotypes? |
There was a problem hiding this comment.
What is the use case? You actually want to avoid having (for instance) multiple interceptors that all have the same priority because then you don't know which one goes first. And in case of alternatives, it is probably even an error to have two with identical priority.
There was a problem hiding this comment.
| The second bean is able to serve the same role in the system as the first. | ||
| In a particular deployment, only one of the two beans may fulfill that role. | ||
|
|
||
| Specialization is only present in {cdi_full} and is specified therein. |
There was a problem hiding this comment.
Maybe add a link to the chapter?
There was a problem hiding this comment.
Can do. I think back-links from Full to Lite are very important -- the other way, not so much.
| * `jakarta.enterprise.inject.Any` | ||
| * `jakarta.enterprise.inject.Default` | ||
| * `jakarta.enterprise.inject.Specializes` | ||
| // TODO move to Full? |
There was a problem hiding this comment.
I noticed these as well. IMO if the user gets to consume the exact same CDI API jar, then there is little reason to extract this from spec as those literals are simply present, even though their respective annotations are ignored by Lite.
Or you could just separate these two and add them right below, stating that these are related to CDI Full?
|
|
||
| * the bean is not a decorator | ||
| * the bean is not a decorator, | ||
| * the bean is either not an alternative, or the module is a bean archive and the bean is a selected alternative of the bean archive. |
There was a problem hiding this comment.
+1 for overriden becuase with the last sentence you added, the rules become very cryptic.
There was a problem hiding this comment.
I think a similarly cryptic sentence is present in the original, but I see what you mean :-)
There was a problem hiding this comment.
Yeah,... I never said the original was better :D
| @@ -7,10 +7,10 @@ This specification defines a powerful set of complementary services that help to | |||
| * A sophisticated, typesafe _dependency injection_ mechanism, including the ability to select dependencies at either development or deployment time, without verbose configuration | |||
There was a problem hiding this comment.
I suggest to define cdi full and cdi liter concept first in this chapter and then refer to it.
|
|
||
| == Programmatic access to container | ||
|
|
||
| CDI 3.0 used to provide a single `BeanManager` object, which allows access to many useful operations. |
There was a problem hiding this comment.
This is not only true for CDI 3.0 though. I would say: The CDI version prior to 4.0
There was a problem hiding this comment.
If you could suggest a way how to phrase this without the historical reference, that would be best. I admit I didn't give it much thought, I'll think about it again.
There was a problem hiding this comment.
Prior to CDI 4.0, there used to be a single ....?
| `BeanManagerLite` provides access to a subset of `BeanManager` features which can be implemented in more restricted environments; | ||
| It is available in {cdi_lite} environments. | ||
|
|
||
| `BeanManager` extends `BeanManagerLite` and provides the remaining features. |
There was a problem hiding this comment.
the remaining features -> more capabilities
| It is available in {cdi_lite} environments. | ||
|
|
||
| `BeanManager` extends `BeanManagerLite` and provides the remaining features. | ||
| It is available in {cdi_full} environments. |
There was a problem hiding this comment.
{cdi_full} environments environments -> a {cdi_full} environment
There was a problem hiding this comment.
The plural form here is correct because there are two CDI Full environments - SE and EE
There was a problem hiding this comment.
I'll try to rephrase this paragraph today, there are too many comments so I clearly have to do a better job :-)
|
|
||
| === The `BeanManagerLite` object | ||
|
|
||
| The interface `jakarta.enterprise.inject.spi.BeanManagerLite` provides operations for obtaining contextual references for beans, along with many other operations of use to applications. |
There was a problem hiding this comment.
Can BeanManagerLite be looked up via jndi lookup at runtime?
There was a problem hiding this comment.
I believe we should avoid references to JNDI, as well as other Jakarta EE concepts, in Lite.
There was a problem hiding this comment.
(In fact, I briefly thought we should move that JNDI thing to the EE section. I don't know why it's present in "Core CDI", it's clearly EE only and for example can't be used in SE.)
EDIT: I just realized you can have JNDI in SE. I'd still like to avoid references to JNDI in Lite.
There was a problem hiding this comment.
I think I raised this question at some earlier comment on the BM Lite PR as well. Technically speaking you can get the BML via JNDI simply because you can get ordinary BM (which extends BML).
That being said, IMO we don't want any specific notion of Lite supporting JNDI in any way.
|
FTR, the HTML diff for the latest commit in this PR is now available at https://ladicek.github.io/cdi-spec/. |
|
As discussed, we want to avoid having |
|
Looking at the diff I published yesterday, I have noticed some typos -- some of then I fixed yesterday, some of them I fixed right now. I also tried to rephrase that one paragraph under "Programmatic access to container". Latest diff is available at https://ladicek.github.io/cdi-spec/diff4.html |
| ---- | ||
|
|
||
| The operations of `BeanContainer` may be called at any time during the execution of the application. | ||
| // TODO Full has restrictions on when BeanManager methods can be called, do we want to reflect them here in some way? |
There was a problem hiding this comment.
How about we instead change the The BeanManager object and mention that those rules apply to both, BM and BeanContainer?
There was a problem hiding this comment.
That should be implied by
In {cdi_full} environment,
BeanContaineris subject to the same rules asBeanManager.
What I'm more thinking about here is: if we're saying that in Lite, BeanContainer can be invoked at any time, that's a superset of what's allowed in Full. Which might be problematic at least from the "Lite is a strict subset of Full" perspective.
There was a problem hiding this comment.
Or at least, it might look like a superset. That will depend on how we define the container lifecycle in Lite, which isn't there yet. (In Full, it's defined in the SPI section.)
There was a problem hiding this comment.
BeanContainer can be invoked at any time
That's not what you wrote there though. You stated ... at any time during the execution of the application which means after the CDI container is bootstrapped, doesn't it? In other words, in Lite you cannot even try to use BeanContainer earlier.
And so long as you cannot use BeanContainer where you couldn't use BM (from within extensions), you should be good.
Or am I missing something?
There was a problem hiding this comment.
Again, "at any time during the execution of the application" depends on how we define lifecycle, which we didn't do yet. If we define it in a way that all initialization phases are considered before application execution, then sure.
I added the TODO here mainly as a reminder, to revisit this section after we define lifecycle. I could have worded it more explicitly, for sure -- sorry about that.
This PR solves #cdi-468
Signed-off-by: antoinesd antoine@sabot-durand.net