Environment property is not used in ContainerRequestFilter
See original GitHub issueDescribe the bug I want to use a Configuration Property in my Request Interceptor but when i try to overwrite it with an environmental variable it still uses the one from the application.properties. This behavior only appears when i am running it as a native image.
In this repository you can find the code. https://github.com/niedch/quarkus-env-property
Running in dev mode (mvn compile quarkus:dev) test.property in Interceptor: Injected from environment
Running in container using native-image test.property in Interceptor: Injected from application.properties (even if TEST_PROPERTY is present) One more thing is that everything is fine when using this Configproperty in the RestController Class
Expected Even if application is running as native image property should be injected from env
Actual behavior application is using the property from application.properties
To Reproduce Steps to reproduce the behavior:
- checkout repository
- mvn package -Pnative -Dquarkus.native.container-build=true
- docker build -t envinjection -f src/main/docker/Dockerfile.native .
- docker run -p 8081:8081 --env TEST_PROPERTY=test-from-env envinjection
Environment (please complete the following information):
- uname: 18.04.1-Ubuntu
- Output of
java -version
:
OpenJDK Runtime Environment (build 1.8.0_232-20191008104205.buildslave.jdk8u-src-tar--b07)
OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode)
- GraalVM version (if different from Java): GraalVM Version 19.2.1 CE
- Quarkus version or git rev: 0.28.1
Additional context Logs from application: mvn compile quarkus:dev
2019-11-08 11:38:16,395 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) test property: test-from-env
2019-11-08 11:38:16,395 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) interceptor:
2019-11-08 11:38:16,396 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) SysPropConfigSource
2019-11-08 11:38:16,400 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) EnvConfigSource
2019-11-08 11:38:16,402 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) TEST_PROPERTY : test-from-env
2019-11-08 11:38:16,412 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) PropertiesConfigSource[source=application.properties]
2019-11-08 11:38:16,413 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) PropertiesConfigSource[source=application.properties]
2019-11-08 11:38:16,414 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) test.property : test-property in application.properties
2019-11-08 11:38:16,415 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) PropertiesConfigSource[source=application.properties]
2019-11-08 11:38:16,415 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) test.property : test-property in application.properties
2019-11-08 11:38:16,415 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) PropertiesConfigSource[source=Build system]
2019-11-08 11:38:16,416 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) null:null:ServletConfigSource
2019-11-08 11:38:16,416 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) null:null:FilterConfigSource
2019-11-08 11:38:16,416 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) null:ServletContextConfigSource
2019-11-08 11:38:16,416 INFO [tes.hom.Interceptor] (vert.x-worker-thread-1) default values
2019-11-08 11:38:16,418 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) test property: test-from-env
2019-11-08 11:38:16,418 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) endpoint:
2019-11-08 11:38:16,418 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) SysPropConfigSource
2019-11-08 11:38:16,419 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) EnvConfigSource
2019-11-08 11:38:16,420 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) TEST_PROPERTY : test-from-env
2019-11-08 11:38:16,426 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) PropertiesConfigSource[source=application.properties]
2019-11-08 11:38:16,426 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) PropertiesConfigSource[source=application.properties]
2019-11-08 11:38:16,426 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) test.property : test-property in application.properties
2019-11-08 11:38:16,426 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) PropertiesConfigSource[source=application.properties]
2019-11-08 11:38:16,427 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) test.property : test-property in application.properties
2019-11-08 11:38:16,427 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) PropertiesConfigSource[source=Build system]
2019-11-08 11:38:16,427 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) null:null:ServletConfigSource
2019-11-08 11:38:16,427 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) null:null:FilterConfigSource
2019-11-08 11:38:16,427 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) null:ServletContextConfigSource
2019-11-08 11:38:16,427 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-1) default values
docker run -p 8081:8081 --env TEST_PROPERTY=test-from-env envinjection
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) test property: test-property in application.properties
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) interceptor:
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) SysPropConfigSource
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) EnvConfigSource
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) TEST_PROPERTY : test-from-env
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) PropertiesConfigSource[source=application.properties]
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) PropertiesConfigSource[source=application.properties]
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) PropertiesConfigSource[source=Default configuration values]
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) test.property : test-from-env
2019-11-08 10:43:57,947 INFO [tes.hom.Interceptor] (vert.x-worker-thread-0) default values
2019-11-08 10:43:57,947 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) test property: test-from-env
2019-11-08 10:43:57,947 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) endpoint:
2019-11-08 10:43:57,947 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) SysPropConfigSource
2019-11-08 10:43:57,948 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) EnvConfigSource
2019-11-08 10:43:57,948 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) TEST_PROPERTY : test-from-env
2019-11-08 10:43:57,948 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) PropertiesConfigSource[source=application.properties]
2019-11-08 10:43:57,948 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) PropertiesConfigSource[source=application.properties]
2019-11-08 10:43:57,948 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) PropertiesConfigSource[source=Default configuration values]
2019-11-08 10:43:57,948 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) test.property : test-from-env
2019-11-08 10:43:57,948 INFO [tes.hom.ExampleResource] (vert.x-worker-thread-0) default values
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (4 by maintainers)
I can confirm that it works if you add the following to the interceptor:
And then read the result using
testProperty.get()
I am going to close this as this is not a problem in RESTEasy Reactive