Quarkus - set annotation configs in application.yaml - Stack Overflow

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

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744122184a4559452.html

相关推荐

  • Quarkus - set annotation configs in application.yaml - Stack Overflow

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

    8天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信