Skip to content
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

spring.config.import order is not honored with third-party plugins #881

Closed
tomek82 opened this issue Sep 12, 2023 · 3 comments
Closed

spring.config.import order is not honored with third-party plugins #881

tomek82 opened this issue Sep 12, 2023 · 3 comments
Labels
component: parameter-store Parameter Store integration related issue status: waiting-for-feedback Waiting for feedback from issuer
Milestone

Comments

@tomek82
Copy link
Contributor

tomek82 commented Sep 12, 2023

Type: Bug

Component: Secrets Manager

Describe the bug
Continuing from spring-projects/spring-boot#37273

While trying to use a third party Spring Cloud for AWS to load configuration from Secrets Manager and also a local Properties resource I'm observing this:

With application.properties having:
spring.config.import=configtree:config/,classpath:config.properties

I get this order:

OriginTrackedMapPropertySource {name='Config resource 'class path resource [config.properties]' via location 'classpath:config.properties''}
ConfigTreePropertySource {name='Config tree 'xxx\config''}
OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.properties]' via location 'optional:classpath:/''}

Trying:
spring.config.import=classpath:config.properties,configtree:config/

Gives this order:

ConfigTreePropertySource {name='Config tree 'xxx\config''}
OriginTrackedMapPropertySource {name='Config resource 'class path resource [config.properties]' via location 'classpath:config.properties''}
OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.properties]' via location 'optional:classpath:/''}

So far so good and consistent with documentation which says "Several locations can be specified under a single spring.config.import key. Locations will be processed in the order that they are defined, with later imports taking precedence."

However setting:
spring.config.import=aws-secretsmanager:sample/config,classpath:config.properties

Gives me this:

AwsSecretsManagerPropertySource {name='sample/config'}
OriginTrackedMapPropertySource {name='Config resource 'class path resource [config.properties]' via location 'classpath:config.properties''}
OriginTrackedMapPropertySource {name='Config resource 'class path resource [application.properties]' via location 'optional:classpath:/''}

which makes the Plugin take precedence even if declared before the additional file.

Running with Spring Boot 3.1.3 and spring-cloud-starter-aws-secrets-manager-config v2.4.4.

@maciejwalkowiak
Copy link
Contributor

I can't reproduce this issue in Spring Cloud AWS 3.0.2. See #882 (comment)

@maciejwalkowiak maciejwalkowiak added component: parameter-store Parameter Store integration related issue status: waiting-for-feedback Waiting for feedback from issuer labels Oct 30, 2023
@MatejNedic
Copy link
Member

@maciejwalkowiak can we close this?

@maciejwalkowiak
Copy link
Contributor

Yup

@maciejwalkowiak maciejwalkowiak modified the milestones: 3.0.4, 3.1.0 Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: parameter-store Parameter Store integration related issue status: waiting-for-feedback Waiting for feedback from issuer
Projects
None yet
Development

No branches or pull requests

3 participants