I have multiple datasource , so the type is list , the original configuration is OK , as follows:

the application.yml :

test:
  db:
    datasources:
      - url: jdbc:mysql://localhost:3306/writedb
        username: root
        password: root
      - url: jdbc: mysql://localhost:3306/readdb
        username: root
        password: root

Now ,we must extract username/password to special documents, as follows , I can not get the merged Information

change the the application.yml :

test:
  db:
    datasources:
      - url: jdbc:mysql://localhost:3306/writedb
      - url: jdbc:mysql://localhost:3306/readdb

the application-secrets.yml :

test:
  db:
    datasources:
      - username: root
        password: root
      - username: root
        password: root
@ConfigurationProperties(prefix = "test.db")
@Configuration
public class AutoLoadDataSourceProperties {

    private List<DataSourceCommonProperties> datasources;   

    // get
        // set
}

when start the application , the url is null (but through the Environment.getProperty("test.db.datasources[0].url") ,can get the value ) , How to solve this problem ,Thanks

Comment From: wilkinsona

@crazylulululu I have updated your comment to improve the formatting. You can learn how to do so yourself in GitHub's Markdown guide.

Comment From: wilkinsona

The lack of merging is intentional. I would recommend that you use property placeholders instead:

test:
  db:
    datasources:
      - url: jdbc:mysql://localhost:3306/writedb
        username: ${test.db.datasources.write.username}
        password: ${test.db.datasources.write.password}
      - url: jdbc: mysql://localhost:3306/readdb
        username: ${test.db.datasources.read.username}
        password: ${test.db.datasources.read.password}
test:
  db:
    datasources:
      write:
        username: root
        password: root
      read:
        username: root
        password: root

If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.