Bean initialization with no-default constructor and final fields in Spring Boot

In ConfigurationProperties class I have a Map like this:
@ConfigurationProperties(prefix = "some")
public class SomeConfigurationProperties {
    private Map<String, SomeClass> map = new HashMap<>();
...
}
And I want in mentioned SomeClass all fields to be final, so I had to implement no-default constructor and I am fine with that. The one who is not, is spring initializer, so before starting application, I got this error:
 Caused by: java.lang.NoSuchMethodException: some.package.SomeClass.<init>()
I can't set default constructor in SomeClass cause I will get final fields uninitialized:
The blank final field somefield may not have been initialized
How I should setup initialization of bean SomeClass with no-default constructor, but if it can be without XML Spring configuration, because I am using Spring Boot and don't want to mess up with that.

Комментарии

Популярные сообщения из этого блога

FillChar and StringOfChar under Delphi 10.2 for Win64 Release Target

Intuition behind successive squaring.