Skip to content
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

Regression in configuration injection after migrating from 1.12.2.Final to 2.3.0.Final #20788

Closed
emiste opened this issue Oct 15, 2021 · 5 comments
Assignees
Labels
area/config env/windows Impacts Windows machines triage/invalid This doesn't seem right

Comments

@emiste
Copy link

emiste commented Oct 15, 2021

Describe the bug

I'm getting the following exception after runing a unit test . The same test is OK when using the quarkus's version 1.12.2.Final and 2.2.1.Final .
[ERROR] com.xxx.core.api.CustomerSettingResourceTest.shouldCustomerUserLongIn Time elapsed: 0.018 s <<< ERROR!
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
Caused by: java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Failed to start quarkus
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Error injecting com.xxx.common.config.XConfig com.xxx.core.security.SecurityContextFilter.applicationConfig
Caused by: java.lang.RuntimeException: Error injecting com.xxx.common.config.XConfig com.xxx.core.security.SecurityContextFilter.applicationConfig
Caused by: java.util.NoSuchElementException: SRCFG00027: Could not find a mapping for com.xxx.common.config.XConfig

mybe the issue is related to the fact that com.xxx.core.security.SecurityContextFilter implements javax.ws.rs.container.ContainerRequestFilter

NB: The exception is not raised when using the quarkus's version 2.2.1.Final ( the regression is present in 2.2.2.Final, 2.2.3.Final and 2.3.0.Final)

Expected behavior

Be able to inject configuration inside a ContainerRequestFilter provider

Actual behavior

Configuration is not injected an exception is raised

How to Reproduce?

please clone the following repo : https://github.com/emiste/quarkus.git
run ./mvn install inside the folder reproducer-20257-with-quarkus-2.2.3.Final to get the exception
run ./mvn install inside the folder reproducer-20257-with-quarkus-2.2.1.Final to get build success

Output of uname -a or ver

No response

Output of java -version

java 11.0.4 2019-07-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

Maven home: C:\Users\xxx.m2\wrapper\dists\apache-maven-3.8.1-bin\2l5mhf2pq2clrde7f7qp1rdt5m\apache-maven-3.8.1 Java version: 11.0.4, vendor: Oracle Corporation, runtime: C:\tools\Java\jdk-11.0.4 Default locale: fr_FR, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

The exception is not raised when using the quarkus's version 2.2.1.Final ( the regression is present in 2.2.2.Final , 2.2.3.Final and 2.3.0.Final)

@emiste emiste added the kind/bug Something isn't working label Oct 15, 2021
@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) env/windows Impacts Windows machines labels Oct 15, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 15, 2021

/cc @manovotn, @mkouba

@mkouba
Copy link
Contributor

mkouba commented Oct 15, 2021

CC @radcortez

@radcortez
Copy link
Member

I'll have a look.

@radcortez radcortez self-assigned this Oct 15, 2021
@mkouba
Copy link
Contributor

mkouba commented Oct 15, 2021

Thanks!

@radcortez
Copy link
Member

@emiste this is working, but you need to annotate your @ConfigMapping with @StaticInitSafe. Adding the annotation the code works as expected.

The reason for this is because JAX-RS providers initialize during static init and we don't automatically register discovered sources or mappings in static init. Please check https://quarkus.io/guides/config-mappings#registration.

@radcortez radcortez added triage/invalid This doesn't seem right and removed kind/bug Something isn't working labels Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config env/windows Impacts Windows machines triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants