Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1424

DI: support for named service injection and flexible map/list binding

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1M1
    • 3.1M1
    • None
    • None

    Description

      1. DI wIll support optional named bindings to allow multiple instances of the same type of DI object. E.g.:

      Binder.bind(Class<T> interfaceType, String bindingName)

      2. DI map and list bindings will no longer be tied to the type of object they are injected to. Instead such bindings will require a name. E.g.:

      Binder.bindMap(String bindingName) // Map.class will be used implicitly as the type
      ...
      Someclass {

      public Someclass(@Inject("xyz") Map<String, String> map)

      { ... }

      }

      Note that both DI features are intentionally simplified versions of the corresponding Guice features to avoid overcomplicating of Cayenne DI. E.g. #1 in Guice is done with custom annotations, not Strings, and #2 allows distinguishing between the maps by their parameterized key and value types (same for lists).

      Attachments

        Issue Links

          Activity

            People

              andrus Andrus Adamchik
              andrus Andrus Adamchik
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: