You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2023/03/31 18:31:00 UTC

[jira] [Closed] (SLING-11812) Models Impl: Default values for List/Collection fields cannot be injected

     [ https://issues.apache.org/jira/browse/SLING-11812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert closed SLING-11812.
----------------------------------

> 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.6.0
>
>          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)