Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11812

Models Impl: Default values for List/Collection fields cannot be injected

    XMLWordPrintableJSON

Details

    Description

      If a model defines a field like

          @Inject
          @Default(values = {"v1","v2"})
          private List<String> stringList;
      

      the injection fails due to the List type. it works if an array type is used. this problem affects only the default value, the injection to List and Collection types works for actual values.

      according to https://sling.apache.org/documentation/bundles/models.html#available-injectors-1 both List and Collection types are supported for most injectors.

      Attachments

        Issue Links

          Activity

            People

              sseifert Stefan Seifert
              sseifert Stefan Seifert
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m