Visitar URL original
Config data location does not exist error can be thrown if a profile-specific properties file is directly imported · Issue #26147 · spring-projects/spring-boot · GitHub
Skip to content

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

Closed

Description

@scottfrederick

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:'

Activity

  1. added this to the 2.4.x milestone on Apr 16, 2021
  2. ZouHongxue commented on Apr 20, 2021

    @ZouHongxue

    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

  3. scottfrederick commented on Apr 20, 2021

    @scottfrederick
    ContributorAuthor

    @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.

  4. ZouHongxue commented on Apr 21, 2021

    @ZouHongxue

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

  5. 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[/+] on May 7, 2021
  6. modified the milestones: 2.4.x, 2.4.6 on May 7, 2021
  7. self-assigned this
    on May 7, 2021
  8. added a commit that references this issue on May 7, 2021
    efad44b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions