Merge branch '2.3.x' into 2.4.x

Closes gh-25692
This commit is contained in:
Andy Wilkinson 2021-03-16 16:35:31 +00:00
commit 2560f261cd
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -161,7 +161,7 @@ class DataSourceInitializer {
}
else if (validate) {
throw new InvalidConfigurationPropertyValueException(propertyName, resource,
"The specified resource does not exist.");
"No resources were found at location '" + location + "'.");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -221,8 +221,10 @@ class DataSourceInitializerInvokerTests {
"spring.datasource.schema:classpath:does/not/exist.sql").run((context) -> {
assertThat(context).hasFailed();
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
assertThat(context.getStartupFailure()).hasMessageContaining("does/not/exist.sql");
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.schema");
assertThat(context.getStartupFailure()).hasMessageContaining(
"No resources were found at location 'classpath:does/not/exist.sql'.");
});
}
@ -233,8 +235,10 @@ class DataSourceInitializerInvokerTests {
"spring.datasource.data:classpath:does/not/exist.sql").run((context) -> {
assertThat(context).hasFailed();
assertThat(context.getStartupFailure()).isInstanceOf(BeanCreationException.class);
assertThat(context.getStartupFailure()).hasMessageContaining("does/not/exist.sql");
assertThat(context.getStartupFailure()).hasMessageContaining("[does/not/exist.sql]");
assertThat(context.getStartupFailure()).hasMessageContaining("spring.datasource.data");
assertThat(context.getStartupFailure()).hasMessageContaining(
"No resources were found at location 'classpath:does/not/exist.sql'.");
});
}