jamesfredley opened a new pull request, #15503:
URL: https://github.com/apache/grails-core/pull/15503
## Summary
Builds on #15502 to address two additional gaps and add comprehensive test
coverage for HikariCP property binding.
## Changes
### Bug Fix: `dataSourceProperties` and `healthCheckProperties` coercion
The existing `coerceDbProperties()` only triggered for the `dbProperties`
key. If a user specified `dataSourceProperties` directly in their
`application.yml`, the YAML-produced `LinkedHashMap` was never coerced to
`java.util.Properties`, causing HikariConfig's
`setDataSourceProperties(Properties)` setter to silently fail. The same issue
affected `healthCheckProperties`.
**Before:**
```java
if (properties.containsKey("dbProperties")) {
coerceDbProperties();
}
```
**After:**
```java
coerceMapToProperties("dbProperties");
coerceMapToProperties("dataSourceProperties");
coerceMapToProperties("healthCheckProperties");
```
The new `coerceMapToProperties(String key)` method is a generalized version
that:
- Converts any `Map` value to `Properties` for the given key
- Skips values that are already `Properties` instances
- Filters out null values during coercion
### Comprehensive HikariCP binding tests (8 new test cases)
| Test | What it verifies |
|------|-----------------|
| `dataSourceProperties key is coerced from Map and bound directly` | Using
`dataSourceProperties` key directly (not via `dbProperties` alias) |
| `coercion skips values already of type Properties` | `Properties` objects
pass through without re-coercion |
| `healthCheckProperties as Map is coerced and bound` |
`healthCheckProperties` Map-to-Properties coercion works |
| `HikariCP pool sizing properties are bound correctly` | `maximumPoolSize`,
`minimumIdle` |
| `HikariCP timeout properties are bound correctly` | `connectionTimeout`,
`idleTimeout`, `maxLifetime`, `validationTimeout`, `keepaliveTime`,
`leakDetectionThreshold`, `initializationFailTimeout` |
| `HikariCP connection behavior properties are bound correctly` |
`autoCommit`, `connectionTestQuery`, `connectionInitSql`,
`transactionIsolation`, `catalog`, `schema`, `isolateInternalQueries` |
| `HikariCP pool management properties are bound correctly` | `poolName`,
`registerMbeans` |
| `HikariDataSource is fully configured from comprehensive config map` |
Integration-style test with all property categories combined |
Fixes #15501
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]