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

使用EnvironmentChangeEvent 但是配置没有更新 #5234

Closed
Shy-Chen opened this issue Sep 20, 2024 · 3 comments
Closed

使用EnvironmentChangeEvent 但是配置没有更新 #5234

Shy-Chen opened this issue Sep 20, 2024 · 3 comments
Labels

Comments

@Shy-Chen
Copy link

参考官方的demo 使用如下这种方式来刷新@ConfigurationProperties配置文件 但是没有生效
this.applicationContext.publishEvent(new EnvironmentChangeEvent(changedKeys));
请教下这个是什么问题?

@nobodyiam
Copy link
Member

需要注意的是,@ConfigurationProperties如果需要在Apollo配置变化时自动更新注入的值,需要配合使用EnvironmentChangeEventRefreshScope。相关代码实现,可以参考apollo-use-cases项目中的ZuulPropertiesRefresher.java和apollo-demo项目中的SampleRedisConfig.java以及SpringBootApolloRefreshConfig.java

Copy link

stale bot commented Oct 29, 2024

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 29, 2024
Copy link

stale bot commented Nov 9, 2024

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants