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

Custom CDI Scopes need to support METHOD and FIELD targets

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 1.3.0.Final
    • 1.3.0.Beta7
    • jberet-core
    • 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

      Attachments

        Activity

          People

            cfang@redhat.com Cheng Fang
            cfang@redhat.com Cheng Fang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: