-
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
Spring Config: Using @ConfigurationProperties
to inject lists does not work
#19365
Comments
/cc @geoand |
@ConfigurationProperties
to inject collections does not work@ConfigurationProperties
to inject lists does not work
Most likely you have the
The problem is that |
@radcortez the only dependencies I have in my pom.xml are:
These two dependencies bring the next dependencies:
Note that I'm not using either |
The exception you see is thrown by the config-yaml extension here: Lines 28 to 29 in ab40883
I understood, I was just asking if there was any strong reason to prefer to use |
Using I'm aware that this extension is just a limited wrapper of what Spring indeed does, but I think reporting the current limitations can help to: |
Unfortunately, that is not possible, because as you know,
At this point, we probably need to consider deprecating Quarkus support for Spring Would you consider moving to |
I don't think we can remove the extension as it is part of the product |
Yes, I was not suggesting to remove it now, it would still need to go through a deprecation cycle. |
:D I would never use the Spring extension to play with Quarkus, so I would have used the But my duty was to check the Spring Properties Quarkus extension and see what users of Quarkus can expect of it. So, adding a note in the documentation or improve the exception handling to prevent this work for me. |
Great. Thanks. I'll improve the documentation. |
@radcortez is there a full list of functionality, which is not supported by Quarkus+spring boot properties? For example, the guide, you changed[1] only mentions Maps and not Lists. |
Lists should work. Have you encountered an issue in that area? Still, my recommendation is to use https://quarkus.io/guides/config-mappings :) |
@radcortez "Using @ConfigurationProperties to inject lists does not work" is a name of the issue :) Reproduced with the same code. I totally agree with recommendation, but my task is to check disabled tests, including the ones, made by my former colleague Sgitario, so I need to be sure, that this functionality either works or properly mentioned as non-working. |
Yes, it does not work with the indexed property version, as in |
Is this behavior described somewhere? The only mention I was able to find is "Spring Boot @ConfigurationProperties has a few limitations. For instance, Map injection is not supported. Consider using Mapping configuration to objects"[1], which doesn't mention, that there also may be problems with, for example indexed property version in Lists. |
Describe the bug
When using:
And we inject it into one controller / or resource:
And the following properties:
It fails to start with the following exception:
Which is odd as I'm not using neither YAML nor
@ConfigProperties
(but@ConfigurationProperties
from the Spring extension).Expected behavior
I see that what we're doing internally is to map the
@ConfigurationProperties
annotation to@ConfigProperties
.But I think we should map it to use the
@ConfigMapping
annotation and support the wiring of complex annotations as Spring does.Note that this is also not working for maps.
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: