Closed
Description
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!