]
Petr Kremensky updated WFWIP-55:
--------------------------------
Environment:
{noformat}
git@github.com:jmesnil/wildfly.git:WFLY-10522_microprofile-config-smallrye_extension
{noformat}
Default value defined on injection point of List and Set fields is
not taken into account
-----------------------------------------------------------------------------------------
Key: WFWIP-55
URL:
https://issues.jboss.org/browse/WFWIP-55
Project: WildFly WIP
Issue Type: Bug
Components: MP Config
Environment: {noformat}
git@github.com:jmesnil/wildfly.git:WFLY-10522_microprofile-config-smallrye_extension
{noformat}
Reporter: Petr Kremensky
Assignee: Jeff Mesnil
Assume we define a following injection points:
{code:java}
@Inject
@ConfigProperty(name = "myPets", defaultValue =
"horse,monkey")
private String[] myArrayPets;
@Inject
@ConfigProperty(name = "myPets", defaultValue = "cat,lama")
private List<String> myListPets;
@Inject
@ConfigProperty(name = "myPets", defaultValue = "dog,mouse")
private Set<String> mySetPets;
{code}
Passing a -DmyPets=snake,ox property work as expected:
{noformat}
myArrayPets : [snake,ox]
myListPets : [snake,ox]
mySetPets : [snake,ox]
{noformat}
but trying to use the defults I get:
{noformat}
myArrayPets : [horse,monkey]
myListPets : <empty list>
mySetPets : <empty set>
{noformat}
defaults are not applied to List and Set fields, no exception is thrown.
Another inconsistency between Array and Set+List I run into is behaviour on missing
property (myPets is not set):
*Array*
{code:java}
@Inject
@ConfigProperty(name = "myPets")
private String[] myArrayPets;
>>>
08:34:05,178 ERROR [stderr] (MSC service thread 1-2)
org.jboss.weld.exceptions.DeploymentException: Error while validating Configuration
08:34:05,178 ERROR [stderr] (MSC service thread 1-2) No Config Value exists for myPets
myArrayPets : [org.eclipse.microprofile.config.configproperty.unconfigureddvalue]
{code}
*Set, List*
{code:java}
@Inject
@ConfigProperty(name = "myPets")
private List<String> myListPets;
@Inject
@ConfigProperty(name = "myPets")
private Set<String> mySetPets;
>>>
no errors
myListPets : <empty list>
mySetPets : <empty set>
{code}
https://microprofile.io/project/eclipse/microprofile-config/spec/src/main...