list of elements in configurationproperties and profiles

list of elements in configurationproperties and profiles

I am running an application with SpringBoot 2.1.1.RELEASE.

I am running an application with SpringBoot 2.1.1.RELEASE.

I have a yml file with list of elements configured in the default profile and also in a "local" profile

  one: oneOne, oneTwo
  three: nzerjpeojr 


  • id: idOne name: nameOne

spring: profiles: local

listOfSimpleObjects: two: twoOne,twoTwo


  • id: idTwo name: nameTwo

I want to map that configuration into a properties file whose definition is

public class MyProperties {
private Map<String, List<String>> listOfSimpleObjects = new HashMap<String, List<String>>();
private List<SubConfig> listOfObjects = new ArrayList<>();

public Map<String, List<String>> getListOfSimpleObjects() { return listOfSimpleObjects; }

public void setListOfSimpleObjects(Map<String, List<String>> listOfSimpleObjects) { this.listOfSimpleObjects = listOfSimpleObjects; }

public List<SubConfig> getListOfObjects() { return listOfObjects; }

public void setListOfObjects(List<SubConfig> listOfObjects) { this.listOfObjects = listOfObjects; } }

public class SubConfig { private String id; private String name;

public String getId() { return id; }

public void setId(String id) { = id; }

public String getName() { return name; }

public void setName(String name) { = name; } }

Running with the profile "local" I was expecting to have a MyProperties object with three elements in the listOfSimpleObjects and two in the listOfObjects but it is not the case.

Below a Junit test that tells me that there is only one element in the listOfObjects.

public class MyPropertiesTest {
    private MyProperties props;

public void testOnListOfStrings() {
    // this assertion is ok :)

public void testOnListOfObjects() {
    // this assertion fails :(


I asked a colleague of mine who that it was all about the key of the elements as the yml file is at first represented in a big HashMap.

So I guess there is no real answer to the question I could ask, but anyway:

  • is there any way to have a merge version of the listOfObject ?
  • Could SpringBoot be enhanced in order to support such feature (ie in case of detection of a list of items the merge is possible)

Thanks for any kind of answer :)

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Spring Boot Tutorials - Spring Boot Full Course

Spring Boot Tutorials | Full Course - What is Spring? Spring Boot is an open source Java-based framework used to create a Micro Service. Spring Boot contains a comprehensive infrastructure support for developing a micro service and enables you to develop enterprise-ready applications that you can “just run”.

Spring Boot - Spring Security + JWT Complete Tutorial With Example

Learn how to implement spring security using JWT (JSON Web Token). What is JWT? Why JWT? JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred between two parties. Spring Boot - Spring Security + JWT Complete Tutorial With Example

Spring Boot With Spring Data JPA

Welcome to the Spring Boot with Spring Data JPA tutorial! In this tutorial, we are going to see how Spring Data JPA provides complete abstraction over the DAO layer. We don’t need to write the implementation for the DAO layer anymore; Spring Data auto-generates the implementation DAO implementations.