@Component public class DataSourceConfigurationUtil extends ConfigurationUtilBase
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
configSuffix |
protected String |
typeSuffix |
binder, configurableEnvironment, logger| 构造器和说明 |
|---|
DataSourceConfigurationUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
DataSource |
getDataSource(String prefix)
create DataSource from a whole config node,incude type and data-config
|
DataSource |
getDataSource(String type,
String dataSourceConfigPath)
create DataSource from type and the config path of datasource
|
getBinder, getConfigurableEnvironment, init@Value(value="${data-source-type-suffix:type}")
protected String typeSuffix
@Value(value="${data-source-config-suffix:data-config}")
protected String configSuffix
public DataSource getDataSource(String prefix)
prefix - the path of whole config node.
the path of type is ${prefix}.type,the path of dataSourceConfigPath is ${prefix}.data-config.
"type" and "data-config" can be defined in service.general.db-resource-type-suffix and service.general.db-resource-config-suffixpublic DataSource getDataSource(String type, String dataSourceConfigPath)
type - DataSource type : one of in org.springframework.boot.jdbc.DataSourceBuilder.DATA_SOURCE_TYPE_NAMESdataSourceConfigPath - the config path of datasourceCopyright © 2019. All rights reserved.