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/28 10:31:00 UTC
[jira] [Created] (SLING-11812) Models Impl: Default values for List/Collection fields cannot be injected
Stefan Seifert created SLING-11812:
--------------------------------------
Summary: 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
Fix For: Models Implementation 1.5.6
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)