Skip to content

Commit 2560f26

Browse files
committed
Merge branch '2.3.x' into 2.4.x
Closes gh-25692
2 parents 3e876ac + 017dbe6 commit 2560f26

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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-
"The specified resource 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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -221,8 +221,10 @@ void testDataSourceInitializedWithInvalidSchemaResource() {
221221
"spring.datasource.schema:classpath:does/not/exist.sql").run((context) -> {
222222
assertThat(context).hasFailed();
223223
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
224-
assertThat(context.getStartupFailure()).hasMessageContaining("does/not/exist.sql");
224+
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
225225
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.schema");
226+
assertThat(context.getStartupFailure()).hasMessageContaining(
227+
"No resources were found at location 'classpath:does/not/exist.sql'.");
226228
});
227229
}
228230

@@ -233,8 +235,10 @@ void dataSourceInitializedWithInvalidDataResource() {
233235
"spring.datasource.data:classpath:does/not/exist.sql").run((context) -> {
234236
assertThat(context).hasFailed();
235237
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
236-
assertThat(context.getStartupFailure()).hasMessageContaining("does/not/exist.sql");
238+
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
237239
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.data");
240+
assertThat(context.getStartupFailure()).hasMessageContaining(
241+
"No resources were found at location 'classpath:does/not/exist.sql'.");
238242
});
239243
}
240244

0 commit comments

Comments
 (0)