Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1003

support @Produces in partial-beans

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.0
    • 1.5.1
    • PartialBean
    • None

    Description

      it allows to use partial-bean methods also as simple producers of (qualified) types. the main use-case is about exposing injectable values without additional producer-classes since partial-beans are mainly about exposing values (and invoking generic-methods) easily. implication: we don't need to support disposer-methods for now.

      example:

      @TypeSafeConfig //partial-bean binding
      public interface Config
      {
          @Produces
          @ApplicationName //custom
          String name();
      
          String version();
      }
      //+ handler
      

      that allows to inject Config and access the methods or just inject a string qualified with @ApplicationName. -> it's mainly a shortcut similar to producers based on BaseConfigPropertyProducer.

      a version based on BaseConfigPropertyProducer would look like:

      public class ConfigProducer extends BaseConfigPropertyProducer
      {
          @Produces
          @ApplicationName
          public String applicationName(InjectionPoint injectionPoint)
          {
              return getStringPropertyValue(injectionPoint);
          }
      }
      

      Attachments

        Activity

          People

            gpetracek Gerhard Petracek
            gpetracek Gerhard Petracek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: