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

More config issues in Quarkus 1.13.4.Final #17278

Closed
hrstoyanov opened this issue May 17, 2021 · 3 comments · Fixed by #17390
Closed

More config issues in Quarkus 1.13.4.Final #17278

hrstoyanov opened this issue May 17, 2021 · 3 comments · Fixed by #17390
Labels
Milestone

Comments

@hrstoyanov
Copy link

hrstoyanov commented May 17, 2021

Describe the bug

Consider this config setup:

@ConfigMapping(prefix = "dbproxy")
public interface DBProxyConfig {
    @WithName("thread_pool")
    Optional<ThreadPoolConfig> threadPool();
}

public interface ThreadPoolConfig {

    @WithName("prefix")
    @WithDefault("dbproxy-")
    String prefix();

    @WithName("min")
    @WithDefault("0")
    int minThreads();

    @WithName("max")
    @WithDefault("2147483647")//Integer.MAX_VALUE
    int maxThreads();

    @WithName("keep_alive_in_seconds")
    @WithDefault("60")
    int keepAliveInSeconds();
}

and this YAML config file:

dbproxy:
  thread_pool:
    prefix: mypool
    keep_alive_in_seconds: 10

Expected behavior

The thread pool configuration is extracted properly.

Actual behavior

Smallrye Config will fail to pick up the thread pool attributes, will default to an empty optional.

Bizarrely, we can make this work, if we do these changes:

public interface DBProxyConfig {
    @WithName("threadpool")
    Optional<ThreadPoolConfig> threadpool();
}

dbproxy:
  threadpool:
    prefix: mypool
    keep_alive_in_seconds: 10

but this is hardly acceptable! Note that changing the method name above to threadPool() will break it again!

Environment (please complete the following information):

Output of uname -a or ver

20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:41 PDT 2021; root:xnu-7195.101.2~1/RELEASE_ARM64_T8101 arm64

Output of java -version

openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9)
OpenJDK 64-Bit Server VM (build 16.0.1+9, mixed mode)

Quarkus version or git rev

Quarkus 1.13.4.Final

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

Gradle 7.0.1

Build time: 2021-05-10 16:08:58 UTC
Revision: 67e618faef187783dadd03a34fdab9dc71b85b19

Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 16.0.1 (BellSoft 16.0.1+9)
OS: Mac OS X 11.3.1 aarch64

@hrstoyanov hrstoyanov added the kind/bug Something isn't working label May 17, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented May 17, 2021

/cc @evanchooly

@hrstoyanov
Copy link
Author

@radcortez

@radcortez
Copy link
Member

Fixed in smallrye/smallrye-config#570.

@radcortez radcortez linked a pull request May 20, 2021 that will close this issue
@radcortez radcortez modified the milestones: 1.3.5.Final, 1.13.5.Final May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants