[
https://issues.apache.org/jira/browse/SLING-11812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seifert resolved SLING-11812.
------------------------------------
Resolution: Fixed
https://github.com/apache/sling-org-apache-sling-models-impl/commit/13ac77895051340159a81d6ba8a43c1b495d8895
> Models Impl: Default values for List/Collection fields cannot be injected
> -------------------------------------------------------------------------
>
> Key: SLING-11812
> URL: https://issues.apache.org/jira/browse/SLING-11812
> Project: Sling
> Issue Type: Bug
> Components: Sling Models
> Affects Versions: Models Implementation 1.5.4
> Reporter: Stefan Seifert
> Assignee: Stefan Seifert
> Priority: Major
> Fix For: Models Implementation 1.5.6
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> If a model defines a field like
> {code:java}
> @Inject
> @Default(values = {"v1","v2"})
> private List<String> stringList;
> {code}
> 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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)