Is it possible to have immutable (final) fields with Spring Boot\'s @ConfigurationProperties
annotation? Example below
@ConfigurationProperties(
You can set the field values through @Value
annotations. These can be placed directly on the fields and don't require any setters:
@Component
public final class MyProps {
@Value("${example.neededProperty}")
private final String neededProperty;
public String getNeededProperty() { .. }
}
The downside of this approach is: