-
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
Injecting ConfigMapping in resteasy containerrequestfilter causes NoSuchElementException #18333
Comments
/cc @radcortez fyi |
/cc @geoand too |
@radcortez why would this be happening? What is special about Is this perhaps similar to #18237 ? |
Yes, the mappings are only registered for the runtime Config instance, not for static config. Again, that is on purpose, because not every source may be available on static init, and the config behavior may differ from static to init (calls to the same property name may yield different results). Still, this seems to be something that users are relying on, so we can support it. I was already planning to move the registration code to the config generator. |
The PR fixing this has been reverted for now. A future fix is expected but we have no timeline for it. |
For me this still happens in quarkus 2.7.1: I have a property Class mapped with @ConfigMapping. Injecting the property class inside
Fails the Application with "Could not find mapping for ...." |
Is your mapping annotated with |
Hi @radcortez, annotating my property interface like this:
made it injectable in my Thank you very much for the quick help. |
I found my application would work on startup, but then crash on hot reload, if I marked my config However, the solution in https://stackoverflow.com/questions/68769397/jar-rs-filter-injection-of-a-cdi-singleton-that-reference-a-configmapping-objec seems to be working for me. Wrapping my config (or the thing that uses it) in |
:)
The main issue is that filters are initialized at static init. Some configuration sources are not available at static init, because dependent services are not available yet to retrieve them (think for instance, a database-based config source). The The live reloading might be another issue. I've recently improved the dev reload for configuration in #30964. I hope that helps. |
Thanks, @radcortez! Oddly, the configuration that was causing failures if I marked it |
Sure, let me know if that fixes it. If not, I'll have a look. |
Describe the bug
This one is quite similar to #17466, except this issue is about containerrequestfilter, while the other was about requestscoped observer.
Expected behavior
App should start without problems.
Actual behavior
To Reproduce
Steps to reproduce the behavior:
requestscoped-test.zip
Configuration
some.value=abc
Environment (please complete the following information):
Output of
uname -a
orver
MSYS_NT-10.0 NANB7NLNVP2 2.10.0(0.325/5/3) 2018-06-13 23:34 x86_64 Msys
Output of
java -version
openjdk 11.0.7 2020-04-14 LTS
OpenJDK Runtime Environment Zulu11.39+15-CA (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.39+15-CA (build 11.0.7+10-LTS, mixed mode)
Quarkus version or git rev
2.0.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\eclipse\tools\apache-maven\bin..
Java version: 11.0.7, vendor: Azul Systems, Inc., runtime: C:\eclipse\tools\java\11
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
The text was updated successfully, but these errors were encountered: