admin管理员组

文章数量:1399509

Currently I have annotation properties in my application.properties, such as:

my.project.MyClass/myFunction/Retry/maxRetries=3
my.project.MyClass/myFunction/Retry/delay=400

Is it possible to put these values in my application.yaml (that gets picked up at runtime)?

Currently I have annotation properties in my application.properties, such as:

my.project.MyClass/myFunction/Retry/maxRetries=3
my.project.MyClass/myFunction/Retry/delay=400

Is it possible to put these values in my application.yaml (that gets picked up at runtime)?

Share Improve this question asked Mar 26 at 22:42 MiketheCalamityMiketheCalamity 1,2681 gold badge15 silver badges36 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

This is indeed possible, but in a not-exactly-intuitive manner: add a newline and indentation on each .:

my:
  project:
    MyClass/myFunction/Retry/maxRetries=3
    MyClass/myFunction/Retry/delay=400

However, note that since Quarkus 3.18 (and SmallRye Fault Tolerance 6.7.0), there is a new set of fault tolerance configuration properties that is much more aligned with common Quarkus configuration. It is documented here: https://quarkus.io/guides/smallrye-fault-tolerance#configuration-reference

In the .properties format, your configuration would look like this:

quarkus.fault-tolerance."my.project.MyClass/myFunction".retry.max-retries=3
quarkus.fault-tolerance."my.project.MyClass/myFunction".retry.delay=400

and in the YAML format:

quarkus:
  fault-tolerance:
    "my.project.MyClass/myFunction":
      retry:
        max-retries: 3
        delay: 400

The old configuration properties still work, but the new ones are an improvement IMHO.

本文标签: Quarkusset annotation configs in applicationyamlStack Overflow