Uploaded image for project: 'JBeret'
  1. JBeret
  2. JBERET-373

Custom CDI Scopes need to support METHOD and FIELD targets

    Details

    • Type: Feature Request
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 1.3.0.Beta7
    • Fix Version/s: 1.3.0.Final
    • Component/s: jberet-core
    • Labels:
      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

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                cfang Cheng Fang
                Reporter:
                cfang Cheng Fang
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: