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 with nacos' no load profile properties #2450

Closed
mailingfeng opened this issue Mar 11, 2022 · 5 comments
Closed

'spring.config.import with nacos' no load profile properties #2450

mailingfeng opened this issue Mar 11, 2022 · 5 comments
Labels
area/nacos spring cloud alibaba nacos kind/discussion Mark as discussion issues/pr

Comments

@mailingfeng
Copy link

Which Component
Nacos Config - V2021.0.1.0

Describe the bug
'spring.config.import with nacos config' no load profile properties. this difference from 'Bootstrap with nacos config'

difference between the two

1. Bootstrap with nacos config

NacosPropertySourceLocator
image

2. spring.config.import with nacos config

NacosConfigDataLoader
image

@DanielLiu1123
Copy link
Collaborator

Yep, this is the difference. Old way will listening multiple configs base on profile. In most case, we not use all of them, so it's kind of a waste.

Now, you can configure like this.

spring:
  profiles:
    active: prod,dev
---
spring:
  config:
    activate:
      on-profile: "dev"
    import: optional:nacos:test-dev.yml
---
spring:
  config:
    activate:
      on-profile: "prod"
    import: optional:nacos:test-prod.yml

@DanielLiu1123 DanielLiu1123 added area/nacos spring cloud alibaba nacos kind/discussion Mark as discussion issues/pr labels Mar 11, 2022
@mailingfeng
Copy link
Author

ok, i can configure like it.

By the way, this implementation in compliance with springboot specifications ?

Here's the note from springboot document: springboot-features.external-config.files.profile-specific

image

@DanielLiu1123
Copy link
Collaborator

DanielLiu1123 commented Mar 11, 2022

If configs are from external stores, i don't think it's appropriate, sometimes it makes people feel confused.

But we need to discuss whether this feature is supported.

@qiuzhangming
Copy link

qiuzhangming commented Oct 11, 2022 via email

@Dr-wgy
Copy link

Dr-wgy commented Jan 8, 2025

how can i let nacosPropertySourceLocator work add spring-cloud-boostrap.jar and add boostarp.yaml ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/nacos spring cloud alibaba nacos kind/discussion Mark as discussion issues/pr
Projects
None yet
Development

No branches or pull requests

4 participants