You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to reproduce the example of the Map Support example from the documentation. However, I get an NoSuchElementException when trying to read a configuration value as Map. I use version 3.2.1 and the programmatical access without any CDI involved in my setup.
In more detail, I performed the following steps:
I added
server.reasons=200=OK;201=Created
to my META-INF/microprofile-config.properties file.
I have a simple main method with the following code:
Contrary to what I expect, I get the following output
200=OK;201=Created
Exception in thread "main" java.util.NoSuchElementException: SRCFG00014: The config property server.reasons is required but it could not be found in any config source
at io.smallrye.config.SmallRyeConfig.getValues(SmallRyeConfig.java:186)
<...>
Additionally, I also overrode the server.reasons by setting an environment variable SERVER.REASONS but I got the same exception.
The text was updated successfully, but these errors were encountered:
Unfortunately, the documentation is incorrect. The format value of server.reasons=200=OK;201=Created is only intended to be used with org.eclipse.microprofile.config.inject.ConfigProperty#defaultValue, since it can only accept a String value.
In regular config sources, like properties files, a Map is expressed like map.path.key=value. Updating your example:
Hi, I am trying to reproduce the example of the Map Support example from the documentation. However, I get an NoSuchElementException when trying to read a configuration value as Map. I use version
3.2.1
and the programmatical access without any CDI involved in my setup.In more detail, I performed the following steps:
META-INF/microprofile-config.properties
file.server.reasons
by setting an environment variableSERVER.REASONS
but I got the same exception.The text was updated successfully, but these errors were encountered: