-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cdi req #181
Add cdi req #181
Conversation
57920a5
to
3f1e607
Compare
3f1e607
to
dec859d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few wording issues (producer/bean and probably a classloader unification to do) but overall +1 (no need to go back in review if the changes are ok ;))
|
||
==== Additional requirements for CDI bean instances | ||
|
||
===== Producer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Producer/Bean/
a producer is a field or method with @Producer
which enables the container to register a Bean<?>
which is a generic available "factory". Consumers only see beans.
Do we want to support a few more primitive/wrappers? Any impl not doing it?
Lastly we must define what @Dependent
gives, whicih is likely during component lookup (after thread local will be off in all impl) so it is not dependent on the job execution but on the initialization only, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a producer is a field or method with @Producer which enables the container to register a Bean<?> which is a generic available "factory". Consumers only see beans.
So we just say the batch runtime should ensure there is a Bean.. and whether it is done via Producer or some other method like an extension is just an implementation detail? I think I got it.
Do we want to support a few more primitive/wrappers? Any impl not doing it?
I was hoping to still do this in #43
Lastly we must define what @dependent gives, whicih is likely during component lookup (after thread local will be off in all impl) so it is not dependent on the job execution but on the initialization only, no?
I was trying to say that the values would be set the same as in the **Properties for Dependent-scoped bean instances
** which implies we potentially have to wait until job execution for the JSL substitution to take place. That's why I separated out Dependent scope from the other scopes.
Seems like we have a different take on this. I'm thinking you do want to take advantage of JSL subsitution but you also want CDI injection, etc. Do you see a use case where this isn't possible?
Thx for the review @radcortez .. and I can see you're not a fan of two spaces after a period :) so I cleaned that up. Appreciate it. |
DI-neutral language to properly describe CDI requirements Signed-off-by: Scott Kurz <skurz@us.ibm.com>
688eddc
to
436e138
Compare
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
436e138
to
c3a4349
Compare
From ML: clarify that for "===== Properties for Dependent-scoped bean instances" we're referring to the resolution of values, not injection. (If a better wording can be found). |
5c3fce4
to
c3a4349
Compare
Let me respond to @rmannibucau 's comment from the ML: https://www.eclipse.org/lists/jakartabatch-dev/msg00241.html
I think what he's getting at is that:
I did try an example using
I hit some problems. In both Open Liberty & JBeret we do get a non-null InjectionPoint passed to the property producer method, but then we get an NPE. I think this is because of the logic "try to get the default property name from the field name". So maybe this could be considered a bug in each impl then.. not prioritizing this use case yet. In BatchEE, OTOH, I see a null InjectionPoint passed to the property producer method, so we just get a null back. (Batchee => OWB, OL + JBeret => Weld). Now... unless I did something wrong, I don't want to get caught up in this issue which these three impls don't seem to work with. But maybe we can make the same point in the spec using another example: when a batch artifact bean injects some other bean, can that bean have batch properties and contexts injected within? (@follis raised this as: #132). I think this illustrates the ThreadLocal-based resolution of properties and contexts. To illustrate this latter case and the select, Instance.get() that I couldn't get to work I forked a BatchEE UT:
|
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
No I meant to nest all of this under |
652908c
to
1785f04
Compare
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
1785f04
to
469925e
Compare
Hi, thank you for the reviews so far. There have been enough changes that I'm going to dismiss the previous reviews. Hopefully at least some of you can take another look. I'll try to guide you on the most recent changes. WHY CHANGE?@rmannibucau made some comments on the ML: Now, I'm not sure I completely understand Romain's comments and terminology. But trying to think through the issues on my own led me to take a different path. KEY CHANGEBasically I tried to say that any context or properties bean instance created on a batch thread of execution gets its values from the batch job: for properties from the artifact being loaded or executed, and for the contexts from the step/job being executed on that thread. Before had said: "you can inject batch properties into a Dependent-scoped batch artifact bean predictably but injecting into an ApplicationScoped-bean is undefined. Now in this latest revision I reworded to show that the Dependent-scoped batch artifact gives the expected context/property values because the new bean instance is created from the current batch execution thread. But I tried to show that you can ALSO use a more dynamic approach to have a bean created on the current execution thread, with the correct values, e.g. inject a @BatchProperty Instance into an ApplicationScoped-bean and then do an Instance.get() from within the current execution thread. I didn't go into too much detail about what a batch thread of execution means. Historically we've tried to say as little as possible here and have never gone into too much detail. The basic TCK coverage can hopefully cover us enough. SUMMARY of GUARANTEED TO WORK USE CASESAs mentioned in 9.3.3.3 and 9.4.3.1, the spec basically guarantees you can do the three use cases:
Another significant consequence is that you can also access the contexts/properties from a NON-BATCH-ARTIFACT.. running on the batch execution thread. E.g. statically inject the contexts, which could be fairly useful (injecting the properties would be possible though not as obviously useful). LESSER CHANGESFinally, a small change is that I think it's an implementation-detail to say the context/property beans need to be HOW TO REVIEW THE CHANGE
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to be picky there are still some sentences making cdi injection = field injection (whereas it can be methods or constructor too) but I think the goal is reached to clarify the IoC integration and these sentences can be seen as very acceptable "language abuse" so +1
Thx @rmannibucau for your re-review and of course the many rounds of feedback to get to this point. I agree the language is a bit loose w.r.t field vs method vs ctor injection. Since this issue / PR is somewhat blocking (the primitive wrapper PR is stacked on top of it), let me move that discussion to #50, since maybe we are close to closing this one. |
I'm planning on merging this today. With EOY approaching, given the reviews that have already been done, and given Romain already re-reviewed.... I think we got most of the comments we're going to get. |
Fixes #46
Guide to reviewing:
property values? Did I wrongly add the "no matching property" use case??? Will have to check)
Finally, I might have messed up some links , section refs so please keep an eye out for that.