-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Converter registered for interface java.util.Map #8017
Comments
I think this behavior is by design, but I am not 100% sure, so let's ask the expert @dmlloyd |
You're essentially hitting two different problems here. One is that MicroProfile Config does not support generic converter types; Map is a generic type, having two type parameters. The other is that converters only apply to single string values - they cannot be used to aggregate values from multiple properties without special support from the runtime. |
I'm going to close this as invalid. Feel free to reopen if you feel it's not been adequately covered |
Thanks for your quick response! I wasn't aware of that. After reading issues like e.g. this one, I thought it would be possible somehow. If not, I will have to live with that... 😕 |
We have special support for it within our Quarkus configuration code, which is separate from the standard CDI-based stuff. Really I think the MP Config spec needs a bit of a rethink in this area though. My first step in this direction is eclipse/microprofile-config#545. |
Thanks for the clarification and your efforts!! |
Describe the bug
I don't know if it is a bug or a missing feature (or just my fault). I try to use a Map<String, String> as configuration value. I created a custom converter as described here. The example with the int works, using a Map fails.
Expected behavior
It should possible to use a Map as configuration value.
Actual behavior
An exception is thrown (java.lang.IllegalArgumentException: No Converter registered for interface java.util.Map).
But the converter is present and it is used with e.g. ints and doubles.
To Reproduce
Steps to reproduce the behavior:
Configuration
My final goal is to use something like:
Environment (please complete the following information):
Output of
uname -a
:Linux debian 5.4.0-0.bpo.3-amd64 Switch to the Maven distributed copy of the SubstrateVM annotations #1 SMP Debian 5.4.13-1~bpo10+1 (2020-02-07) x86_64 GNU/Linux
Output of
java -version
:openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1deb10u1, mixed mode, sharing)
Quarkus version: 1.2.1-Final and 1.3.0-Final
Build tool (
mvn --version
):Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Java version: 11.0.6, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-0.bpo.3-amd64", arch: "amd64", family: "unix"
Additional context
The example descriped here works, but changing Double to Map<String, String> fails.
This issue might be similar to #7856.
The text was updated successfully, but these errors were encountered: