-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unresolvable placeholder in the value of spring.datasource.url
causes a startup failure even when there is a user-provided DataSource bean
#20438
Comments
@fedelopez Thanks for the report. Could you please try with a 2.2.6 snapshot (available from https://repo.spring.io/snapshot). I am wondering if the problem that you are seeing is a duplicate of #20432. |
I've tried with version Only works when I revert back to |
Thanks for trying out a 2.2.6 snapshot. Can you please share a small sample that reproduces the problem so that we can investigate further? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
You can try this repo. If you push it to Pivotal Web Services will not work with 2.2.5 and 2.2.6.BUILD-SNAPSHOT: https://github.com/fedelopez/spring-boot-issue-20438 |
Thanks for the sample. I believe the change in behaviour is due to this change. |
The problem can be reproduced with this test in @Test
void whenThereIsAUserProvidedDataSourceAnUnresolvablePlaceholderDoesNotCauseAProblem() {
this.contextRunner.withUserConfiguration(TestDataSourceConfiguration.class)
.withPropertyValues("spring.datasource.url:${UNRESOLVABLE_PLACEHOLDER}")
.run((context) -> assertThat(context).getBean(DataSource.class).isInstanceOf(BasicDataSource.class));
} |
@fedelopez You can work around the problem for now by removing We need to fix things in 2.2.6 so that it can back off without the unresolvable placeholder causing a problem. |
spring.datasource.url
causes a startup failure even when there is a user-provided DataSource bean
@fedelopez Also note that Spring Cloud Connectors is in maintenance mode, and the Java CFEnv project is preferred going forward. Java CFEnv is much more Boot-friendly than Connectors, as CFEnv sets properties that allow Spring Boot auto-configuration to create connections whereas Connectors creates connections on its own which causes Boot auto-configuration to back off. With Java CFEnv, you still wouldn't need to set |
I have an
application.yml
config file in a Spring Boot 2.2.4 app with the following entry:spring.datasource.url: ${DATA_SOURCE_URL}
DATA_SOURCE_URL
is available only when running the app locally, not in the cloud.In the cloud (Pivotal Cloud Foundry) we have a PostgreSQL service that injects the data source connection properties automatically using Spring Cloud Connectors. This work perfectly in 2.2.4.
When bumping up the Spring Boot version to 2.2.5 the app won't start:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'DATA_SOURCE_URL' in value "${DATA_SOURCE_URL}"
The text was updated successfully, but these errors were encountered: