testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

feat(module/mysql): Add getR2dbcUrl() to MySQLR2DBCDatabaseContainer

Open papa-piton-2256 opened this issue 2 weeks ago • 0 comments

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) to MySQLR2DBCDatabaseContainer.
  • Returns a formatted string: r2dbc:mysql://<user>:<password>@<host>:<port>/<db>.

Verification

  • Ran ./gradlew :testcontainers-mysql:test locally.
  • Verified that the code style complies with Spotless.

Fixes #8797 Supersedes #9569 (inactive)

papa-piton-2256 avatar Nov 28 '25 07:11 papa-piton-2256