Skip to content

Binding no longer works with sytem environment properties that are not upper case #45741

@PascalSchumacher

Description

@PascalSchumacher

The relaxed binding of Configuration Properties in Spring Boot 3.5.0 is broken for records with field names containing an uppercase letter.

Running this:

@Configuration(proxyBeanMethods = false) @EnableConfigurationProperties({Config.MyProperties.class}) public class Config { @ConfigurationProperties("test") public record MyProperties(String valueName) { public MyProperties(String valueName) { this.valueName = Objects.requireNonNull(valueName); } } } @Component public class MyService { public MyService(MyProperties myProperties){ } } @SpringBootApplication(proxyBeanMethods = false) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }

while a test_value_name environment variable with value abc is present works in 3.4.6 (and earlier), but fails with:

*************************** APPLICATION FAILED TO START *************************** Description: Failed to bind properties under 'test' to example.Config$MyProperties: Reason: org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'test' to example.Config$MyProperties Action: Update your application's configuration 

when using 3.5.0.

See https://github.com/PascalSchumacher/SpringBootConfigurationPropertyBug for running example project.

By the way: Thank you very much for developing/providing Spring Boot!

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions