I have a pretty vanilla Spring Boot v2.6.4 Java application, using Java 17.
I am trying to get records to work for my @ConfigurationProperties, but having little success.
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "custom")
@ConstructorBinding
public record CustomConfigProperties(String path) { }
This fails with:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Configuration class 'CustomConfigProperties' may not be final. Remove the final modifier to continue.
Obviously, records are implicitly final, so I am stumped. No amount of googling yields anything useful. The closest I could find was this SO question, but it's not really directly related Infact a commenter on there has the same issue as me)