diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfiguration.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfiguration.java index 560aa3a5da..33df6947e7 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfiguration.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestDatabaseAutoConfiguration.java @@ -118,6 +118,7 @@ public class TestDatabaseAutoConfiguration { if (ObjectUtils.isEmpty(beanNames)) { logger.warn("No DataSource beans found, " + "embedded version will not be used"); + return null; } if (beanNames.length == 1) { String beanName = beanNames[0];