question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need a way to specify empty list/array in microprofile-config.properties

See original GitHub issue

The MicroProfile Config spec currently specifies that Array Converters are built in, and provides examples of how to configure values that are multiple array elements (delimit by ,). However, it does not appear to document how to configure a value that is an empty array.

On one implementation, I tried out specifying an empty value, like this,

test.property.name=

but it ended up with a value that is an array of size 1 containing the empty string.

I also tried out specifying the value as the value of the org.eclipse.microprofile.config.inject.ConfigProperty.UNCONFIGURED_VALUE constant (lacks documentation, so not sure if this is proper usage. Also, it seems to have two different values depending on which version of the ConfigProperty class is used),

test.property.name.1=org.eclipse.microprofile.config.configproperty.unconfigureddvalue
test.property.name.2=org.eclipse.microprofile.config.configproperty.unconfiguredvalue

but this resulted in a size 1 array containing the specified constant value.

It’s likely the above behavior is to be expected, but the requirement to be able to specify an empty list also seems valid. In another MicroProfile spec, we are utilizing MicroProfile Config to allow the user to supply configuration property values, some of which are lists/arrays. It ought to be possible for MicroProfile Config to have a standard way to set these list/array values to empty.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jmesnilcommented, Jan 18, 2019

@OndroMih iirc you can’t write myPets=dog,cat,dog\,cat as \, is not a valid Java character so you have to double the \ to be able to read it properly

0reactions
dmlloydcommented, Mar 6, 2020

Related to #531.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the best way to set empty array for properties in class ...
You can create an empty list with the new operator: public class TemplateFileResponse { private String path; private List<FileView> children ...
Read more >
Configuration for MicroProfile
When specifying the property myPets=dog,cat,dog\\,cat in a config source, the following code snippet can be used to obtain an array.
Read more >
MicroProfile Config 2.0 - OpenLiberty.io
Config Profile- A special property, called mp.config.profile , that can be used to determine which set of config property values are used.
Read more >
eclipse/microprofile-config
Simply create a jar containing a ConfigSource with a higher ordinal and override configuration values in it. Specifying an empty string as the...
Read more >
Configuring Your Application - Quarkus
In this guide, we will learn how to configure a Quarkus application. ... uses MicroProfile Config annotations to inject the configuration properties in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found