Assuming the below files on my classpath:

  • application-staging.yml
spring:
  data:
    mongodb:
      uri: stagingUrI

# ... (bunch of other properties)
  • application-dev.yml
spring:
  config:
    import: application-staging.yml
  data:
    mongodb:
      uri: myDevOne

When running with dev profile:

Expected: spring.data.mongodb.uri is myDevOne Actual: spring.data.mongodb.uri is stagingUrI

Is it something that should support? Thank you!

Comment From: philwebb

This is the expected behavior and is documented in this section of the reference docs. I'd also generally recommend avoiding importing profile specific files directly.