Skip to content

Commit a832cc9

Browse files
committed
Polish "Improve error message when no resources exist at a script location"
See gh-25620
1 parent 42841b8 commit a832cc9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private List<Resource> getResources(String propertyName, List<String> locations,
161161
}
162162
else if (validate) {
163163
throw new InvalidConfigurationPropertyValueException(propertyName, resource,
164-
"Resource '" + location + "' does not exist.");
164+
"No resources were found at location '" + location + "'.");
165165
}
166166
}
167167
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializerInvokerTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ void testDataSourceInitializedWithInvalidSchemaResource() {
223223
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
224224
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
225225
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.schema");
226-
assertThat(context.getStartupFailure())
227-
.hasMessageContaining("Resource 'classpath:does/not/exist.sql' does not exist.");
226+
assertThat(context.getStartupFailure()).hasMessageContaining(
227+
"No resources were found at location 'classpath:does/not/exist.sql'.");
228228
});
229229
}
230230

@@ -237,8 +237,8 @@ void dataSourceInitializedWithInvalidDataResource() {
237237
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
238238
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
239239
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.data");
240-
assertThat(context.getStartupFailure())
241-
.hasMessageContaining("Resource 'classpath:does/not/exist.sql' does not exist.");
240+
assertThat(context.getStartupFailure()).hasMessageContaining(
241+
"No resources were found at location 'classpath:does/not/exist.sql'.");
242242
});
243243
}
244244

0 commit comments

Comments
 (0)