Skip to content

@Unremovable ConfigMapping is still removed #29631

@Postremus

Description

@Postremus

Describe the bug

I have a ConfigMapping like

@Unremovable
@ConfigMapping(prefix = "appconfig")
public interface AppConfig {
    String defaultLanguage();
}

When I started developing the app, the only place I needed to use this mapping was with programmatic bean selection.

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {

        return CDI.current().select(AppConfig.class).get().defaultLanguage();
        //return "";
    }

This however results in an UnsatisfiedResolutionException: No bean found for required type [interface org.acme.AppConfig]. Full stack trace below.

In the dev ui, I neither see the AppConfig in the Beans or the removed components section of arc.

If I now Inject the AppConfig anywhere in my app, the resource works.

    @Inject
    AppConfig appConfig;

I now also see this entry in the Beans section of the arc dev ui:
image

The unremovable has no effect, but explicitly injecting it somewhere works.

Expected behavior

Unremovable works on ConfigMapping

Actual behavior

__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2022-12-02 06:55:29,088 INFO  [io.quarkus] (Quarkus Main Thread) unremovable-configmapping 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.14.2.Final) started in 0.302s. Listening on: http://localhost:8080

2022-12-02 06:55:29,089 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-12-02 06:55:29,091 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]
2022-12-02 06:55:29,093 INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (Aesh InputStream Reader) Live reload total time: 0.422s
2022-12-02 06:55:30,428 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /hello failed, error id: cecb06e0-0db0-4793-a3e1-a839d11612a8-3: javax.enterprise.inject.UnsatisfiedResolutionException: No bean found for required type [interface org.acm
e.AppConfig] and qualifiers [[]]
        at io.quarkus.arc.impl.InstanceImpl.bean(InstanceImpl.java:191)
        at io.quarkus.arc.impl.InstanceImpl.getInternal(InstanceImpl.java:212)
        at io.quarkus.arc.impl.InstanceImpl.get(InstanceImpl.java:97)
        at org.acme.GreetingResource.hello(GreetingResource.java:20)
        at org.acme.GreetingResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
        at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
        at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)


2022-12-02 06:55:30,432 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: javax.enterprise.inject.UnsatisfiedResolutionException: No bean found for required type [interface org.acme.AppConfig] and qualifiers [[]]
        at io.quarkus.arc.impl.InstanceImpl.bean(InstanceImpl.java:191)
        at io.quarkus.arc.impl.InstanceImpl.getInternal(InstanceImpl.java:212)
        at io.quarkus.arc.impl.InstanceImpl.get(InstanceImpl.java:97)
        at org.acme.GreetingResource.hello(GreetingResource.java:20)
        at org.acme.GreetingResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
        at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
        at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
        at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
        at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:833)

How to Reproduce?

Reproducer:
unremovable-configmapping.zip

  1. mvn quarkus:dev
  2. Go to http://localhost:8080/hello -> UnsatisfiedResolutionException
  3. Add an inject of AppConfig to GreetingResource
  4. Go to http://localhost:8080/hello -> no exception

Output of uname -a or ver

Microsoft Windows [Version 10.0.19044.2251]

Output of java -version

openjdk 19 2022-09-20 OpenJDK Runtime Environment Temurin-19+36 (build 19+36) OpenJDK 64-Bit Server VM Temurin-19+36 (build 19+36, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.14.2.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\eclipse\tools\java\maven Java version: 17.0.4, vendor: Eclipse Adoptium, runtime: C:\eclipse\tools\java\17 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions