Skip to content

Config data location does not exist error can be thrown if a profile-specific properties file is directly imported #26147

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

Closed
scottfrederick opened this issue Apr 16, 2021 · 3 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@scottfrederick
Copy link
Contributor

scottfrederick commented Apr 16, 2021

Create a trivial app from start.spring.io and add four properties file like these:

application.yml:

spring:
  config:
    import: classpath:/imported.yml

some:
  property: "value"

application-dev.yml

spring:
  config:
    import: classpath:/imported-dev.yml

some:
  property: "dev-value"

imported.yml

some:
  property: "imported-value"

imported-dev.yml

some:
  property: "imported-dev-value"

Running the app with the dev profile active will cause an error indicating that imported-dev.yml does not exist, when in fact it does.

***************************
APPLICATION FAILED TO START
***************************

Description:

Config data location 'classpath:/imported-dev.yml' does not exist

Action:

Check that the value 'classpath:/imported-dev.yml' at class path resource [application-dev.yml] - 3:13 is correct, or prefix it with 'optional:'
@ZouHongxue
Copy link

Hi @scottfrederick I've tried a demo with your config on v2.4.5, it works well. Maybe you could check the compiled file in target/classes.

image

@scottfrederick
Copy link
Contributor Author

@ZouHongxue The error shown above happens with this configuration when the dev profile is active. I've edited the description to include this detail. We have written new unit tests to reproduce the problem and are working on a fix.

@ZouHongxue
Copy link

@scottfrederick Yup, it happened in dev profile, thanks let me know

@philwebb philwebb changed the title Importing a profile-specific properties file from another profile-specific properties file causes an error Config data location does not exist error can be thrown if a profile-specific properties file is directly imported May 7, 2021
@philwebb philwebb modified the milestones: 2.4.x, 2.4.6 May 7, 2021
@philwebb philwebb self-assigned this May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants