rajucomp opened a new pull request, #169:
URL: https://github.com/apache/flink-connector-jdbc/pull/169
### FLINK-36236: Fix Overriding the Connection Provider in
`JdbcSourceBuilder`
#### Summary
This PR fixes an issue where a custom `JdbcConnectionProvider` passed via
`JdbcSourceBuilder#setConnectionProvider` was unintentionally overwritten
during the `build()` process. This prevented users from injecting their own
connection management logic (e.g., for testing or advanced connection pooling
scenarios).
#### Changes
- **`JdbcSourceBuilder`**
- Modified `build()` method to only set a default
`SimpleJdbcConnectionProvider` **if** no custom provider has been set.
- **`JdbcSource`**
- Exposed a `getConnectionProvider()` method with `@VisibleForTesting` to
enable access from test code.
- **Test Coverage**
- Added a unit test `testSetConnectionProvider()` to:
- Verify that `null` values are rejected.
- Assert that the `JdbcSource` retains and uses the explicitly provided
`JdbcConnectionProvider`.
#### Motivation
This change ensures the builder pattern behaves predictably: user-provided
values should not be silently overridden. This is especially important when
dependency injection or custom behavior is expected during source
initialization.
--
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]