0

How can i define a Object to read my application.mysql-databases by key:

swaw:
  stage: dev
  ip: x.x.x.x
  port: 3306
  databases:
    mysql:
      url: "jdbc:mysql://...."
      password:
        dba: AAA
        read: BBB
    mssql:
      url: "jdbc:mssql://...."
      password:
        dba: CCC
        read: DDD
    informix:
       ....

I try with this object:

@ConfigurationProperties(prefix = "swaw.databases")
public class Databases {

    private Map<String, DatabasesConfig> map;

    public static class DatabasesConfig {

        private String url;
        private Password password;
        //GETTER AND SETTER

i get per request: {"ip":"1x.x.x.x","port":"3306","databases":null}

emoleumassi
  • 4,881
  • 13
  • 67
  • 93

1 Answers1

0

@emoleumassi - Try this one :

 @ConfigurationProperties(prefix = "databases")
    public class Databases {     

            private String url;
            private Password password;
            //GETTER AND SETTER
    }
kumar
  • 497
  • 4
  • 12