diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java index 2012a7d639..67dd7b02b0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnection.java @@ -101,7 +101,9 @@ public enum EmbeddedDatabaseConnection { OptionsCapableConnectionFactory optionsCapable = OptionsCapableConnectionFactory.unwrapFrom(connectionFactory); if (optionsCapable == null) { 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(); for (EmbeddedDatabaseConnection candidate : values()) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnectionTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnectionTests.java index 54729a2903..a5bab4f5b4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnectionTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/r2dbc/EmbeddedDatabaseConnectionTests.java @@ -89,7 +89,9 @@ class EmbeddedDatabaseConnectionTests { assertThatIllegalArgumentException() .isThrownBy(() -> EmbeddedDatabaseConnection .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 urlParameters() {