在org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration:
@Bean
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public HikariDataSource dataSource(DataSourceProperties properties) {
HikariDataSource dataSource = createDataSource(properties, HikariDataSource.class);
if (StringUtils.hasText(properties.getName())) {
dataSource.setPoolName(properties.getName());
}
return dataSource;
}
参数类型缺少目标类型(例如和许多其他)DataSourceProperties支持的许多属性(显然是设计使然)。因此,许多属性未按照以下记录传递:HikariDataSourcemaximum-pool-sizespring-configuration-metadata.json
{
"name": "spring.datasource.hikari.auto-commit",
"type": "java.lang.Boolean",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
},
{
"name": "spring.datasource.hikari.catalog",
"type": "java.lang.String",
"sourceType": "com.zaxxer.hikari.HikariDataSource"
}
那么我应该定义 dataasource bean 并将属性设置为,那么将上述属性( ...等)作为自动配置属性的一部分HikariDataSource有什么意义呢?spring.datasource.hikari.auto-commit
慕姐4208626
相关分类