Details
-
Feature Request
-
Resolution: Done
-
Major
-
1.3.0.Beta7
-
None
Description
Currently JBeret custom CDI scopes: JobScoped, StepScoped and PartitionScoped all have target TYPE. They should be able to support the use on METHOD and FIELD targets.
Some benefits:
- Some bean classes are out of the control of the application, so there is no way to attach @JobScoped, @StepScoped, or @PartitionScoped to these external bean classes.
- @JobScoped, @StepScoped, or @PartitionScoped at method and field level makes it possible to declare scopes at the point of injection, rather than at the bean class declaration time.
for example,
public class FooProducer { @Produces @JobScoped @Named("FIELD") private FooFieldTarget fooFieldTargetreturn = new FooFieldTarget(); @Produces @JobScoped @Named("METHOD") public FooMethodTarget getFooMethodTarget() { return new FooMethodTarget(); } }
More info about annotation target: https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Target.html