Properties not bound properly for Spring Boot 3.x when using Kotlin. I thought it might be related to issue #33969.
Here is a GitHub project that reproduces the problem: https://github.com/travispeloton/spring-prop-binding-bug
With Spring Boot 3.x. You will see the following in the logs, which is NOT expected:
12:25:43.971 [main] INFO com.example.MyComponent - management.metrics.export.statsd.host=localhost
What we expect is:
12:22:24.878 [main] INFO com.example.MyComponent - management.metrics.export.statsd.host=127.0.0.1
Since we configured it in application.yml:
management:
metrics:
export:
statsd:
flavor: "datadog"
# default is "localhost"
host: "127.0.0.1"
enabled: true
See the spring-2.x branch to see it working correctly with Spring Boot 2.x.
Comment From: travispeloton
When its working correctly, a breakpoint at the following location will be hit during startup, with the expected value:
org.springframework.boot.actuate.autoconfigure.metrics.export.statsd.StatsdProperties#setHost
I see the same problem in all Spring boot 3.x versions released thus-far.
Comment From: scottfrederick
In Spring Boot 3.0, the metrics export properties were changed, as mentioned in the migration guide. Changing management.metrics.export.statsd to management.statsd.metrics.export should fix your problem.
Comment From: travispeloton
Ok thanks. Would be nice for warnings to be printed for an obscure config change like this.
Comment From: scottfrederick
For changes in configuration properties like this, you can get warnings at startup by enabling the properties migrator, as described in the documentation.