Class ManagedDBConfig

  • All Implemented Interfaces:
    DBConfig

    @Dependent
    public class ManagedDBConfig
    extends Object
    implements DBConfig
    Helper class for obtaining DB connection settings using microprofile config.
    General pattern is "roaster.datasource.${dbType}.${schema}.${setting}

    ie.:

      roaster:
          datasource:
              oracle:
                  employee:
                      url: jdbc:oracle:thin:@ldap://ldap.sample.hu:389/SAMPLEDB,cn=OracleContext,dc=sample,dc=hu
                      user: user
                      password: *****
     

    The upper configuration is injectable with:

     @Inject
     @DBConnection(dbType = "oracle", schema = "employee")
     ManagedDBConfig dbConfig;
     

    or:

     ManagedDBConfig dbConfig = CDI.current().select(ManagedDBConfig.class, new DBConnection.Literal("oracle", "employee")).get();
     
    Author:
    balazs.joo
    • Constructor Detail

      • ManagedDBConfig

        public ManagedDBConfig()
    • Method Detail

      • getUrl

        public String getUrl()

        getUrl.

        The url where the selected DB is available.

        Specified by:
        getUrl in interface DBConfig
        Returns:
        url value
      • getUser

        public String getUser()

        getUser.

        The user of the selected DB to connect with.

        Specified by:
        getUser in interface DBConfig
        Returns:
        user value
      • getPassword

        public String getPassword()

        getPassword.

        The password of the selected DB to connect with.

        Specified by:
        getPassword in interface DBConfig
        Returns:
        password value
      • getMaximumPoolSize

        public int getMaximumPoolSize()
        Description copied from interface: DBConfig
        Returns the maximus size of the connection pool
        Specified by:
        getMaximumPoolSize in interface DBConfig
        Returns:
        the maximus size of the connection pool
      • getConfigKey

        public String getConfigKey()
      • setConfigKey

        public void setConfigKey​(String configKey)