Improve error message for non-options-capable ConnectionFactory
Fixes gh-26977
This commit is contained in:
parent
de260148b8
commit
283b4a6ed2
|
|
@ -101,7 +101,9 @@ public enum EmbeddedDatabaseConnection {
|
||||||
OptionsCapableConnectionFactory optionsCapable = OptionsCapableConnectionFactory.unwrapFrom(connectionFactory);
|
OptionsCapableConnectionFactory optionsCapable = OptionsCapableConnectionFactory.unwrapFrom(connectionFactory);
|
||||||
if (optionsCapable == null) {
|
if (optionsCapable == null) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Cannot determine database's type as ConnectionFactory is not options-capable");
|
"Cannot determine database's type as ConnectionFactory is not options-capable. To be "
|
||||||
|
+ "options-capable, a ConnectionFactory should be created with "
|
||||||
|
+ ConnectionFactoryBuilder.class.getName());
|
||||||
}
|
}
|
||||||
ConnectionFactoryOptions options = optionsCapable.getOptions();
|
ConnectionFactoryOptions options = optionsCapable.getOptions();
|
||||||
for (EmbeddedDatabaseConnection candidate : values()) {
|
for (EmbeddedDatabaseConnection candidate : values()) {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,9 @@ class EmbeddedDatabaseConnectionTests {
|
||||||
assertThatIllegalArgumentException()
|
assertThatIllegalArgumentException()
|
||||||
.isThrownBy(() -> EmbeddedDatabaseConnection
|
.isThrownBy(() -> EmbeddedDatabaseConnection
|
||||||
.isEmbedded(ConnectionFactories.get("r2dbc:pool:h2:mem:///" + UUID.randomUUID())))
|
.isEmbedded(ConnectionFactories.get("r2dbc:pool:h2:mem:///" + UUID.randomUUID())))
|
||||||
.withMessage("Cannot determine database's type as ConnectionFactory is not options-capable");
|
.withMessage("Cannot determine database's type as ConnectionFactory is not options-capable. To be "
|
||||||
|
+ "options-capable, a ConnectionFactory should be created with "
|
||||||
|
+ "org.springframework.boot.r2dbc.ConnectionFactoryBuilder");
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream<Arguments> urlParameters() {
|
static Stream<Arguments> urlParameters() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue