use of org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.DataSourceBeanCreationException in project spring-boot by spring-projects.
the class XADataSourceAutoConfiguration method getBinderSource.
private ConfigurationPropertySource getBinderSource(DataSourceProperties dataSourceProperties) {
Map<Object, Object> properties = new HashMap<>();
properties.putAll(dataSourceProperties.getXa().getProperties());
properties.computeIfAbsent("user", (key) -> dataSourceProperties.determineUsername());
properties.computeIfAbsent("password", (key) -> dataSourceProperties.determinePassword());
try {
properties.computeIfAbsent("url", (key) -> dataSourceProperties.determineUrl());
} catch (DataSourceBeanCreationException ex) {
// Continue as not all XA DataSource's require a URL
}
MapConfigurationPropertySource source = new MapConfigurationPropertySource(properties);
ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases();
aliases.addAliases("user", "username");
return source.withAliases(aliases);
}
Aggregations