Skip to content

Unlike many places, @Refreshable and @ConfigurationProperties strictly require kebab-case for proper function #11754

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

Open
sdedic opened this issue Apr 16, 2025 · 0 comments

Comments

@sdedic
Copy link

sdedic commented Apr 16, 2025

Expected Behavior

Rather a documentation suggestion, than a code bug.

Documentation says that property bindings should be declared in kebab-case, but injecting camelCase names works as well (compatibility mode ?), using regular @Value or @ConfigurationProperties - just for initial load only. This is not the case for @Refreshable and automated refresh of @ConfigurationProperties beans.

Actual Behaviour

If @Refreshable("camelCase") is used, the annotated object is NOT refreshed on camel-case or camelCase property change; similarly if @ConfigurationProperties("camelCase") is used, then the bean IS initially loaded, but subsequent refresh event for camel-case property does not re-load that configuration bean's values.

The documentation could warn to strictly adhere to kebab-case here. It's hard to spot since it is an exception from otherwise relexad behaviour in other places, so it could be at least documented.

Steps To Reproduce

  1. Declare a @ConfigurationProperties(:"camelCase") with e.g. String name member
  2. Observe that the "name" member actually loaded from the configuration property
  3. Change the application.properties', property camel-case.name
  4. Have a Environment.refreshAndDiff and appropriate Refresh event fired.
  5. Observe the bean's property did NOT reload

Environment Information

  • Ubuntu Linux 22.04
  • Micronaut 4.7.6

Example Application

No response

Version

4.7.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants