Dendin :
Currently, if my application.yml does not include the mapping of a property, my config class does not initializes the map and leaves it as null instead of empty. How can i make it be empty if no mapping is found?
@Configuration
@ConfigurationProperties(prefix = "someMapping")
@EnableConfigurationProperties
@Getter
@Setter
public class HttpLoggingLevelProperties {
private Map<String, String> loggingLevelMap;
}
Steve Benett :
Just initialize the map yourself. In the default constructor or directly on the field.
private Map<String, String> loggingLevelMap = new HashMap<>();