testcontainers-java
testcontainers-java copied to clipboard
feat(module/mysql): Add getR2dbcUrl() to MySQLR2DBCDatabaseContainer
Motivation
This PR implements the static getR2dbcUrl() helper method for the MySQL module, as requested by @eddumelendez in issue #8797.
Currently, users working with R2DBC drivers have to manually construct connection strings, which is error-prone and verbose. This helper provides a standardized way to obtain a valid R2DBC URL from a running MySQLContainer.
Changes
- Added
public static String getR2dbcUrl(MySQLContainer<?> container)toMySQLR2DBCDatabaseContainer. - Returns a formatted string:
r2dbc:mysql://<user>:<password>@<host>:<port>/<db>.
Verification
- Ran
./gradlew :testcontainers-mysql:testlocally. - Verified that the code style complies with Spotless.
Fixes #8797 Supersedes #9569 (inactive)