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

apollo动态配置不生效 #162

Closed
richardcode991 opened this issue Mar 29, 2022 · 8 comments
Closed

apollo动态配置不生效 #162

richardcode991 opened this issue Mar 29, 2022 · 8 comments
Labels
type: bug Something isn't working
Milestone

Comments

@richardcode991
Copy link

使用版本1.2.0
image

image

getConfig和getConfigFile入参应该和上图一致。

getConfigFile 应该不带后缀吧。

配置:
apollo:
namespace: thread-pool.yml
config-file-type: yml # 配置中心文件格式

@magestacks
Copy link
Member

请参考 Apollo 动态配置示例模块,我测试是没问题的。

@richardcode991
Copy link
Author

richardcode991 commented Mar 29, 2022

我是按照事例配置的,但是apollo非properties,namespaces需要加上后缀,如thread-pool.yml,这样ApolloRefresherHandler中Config config = ConfigService.getConfig(namespace)才会有内容;但是这样配置又导致configChangeListener中ConfigService.getConfigFile最后拼接的路径为thread-pool.yml.yml导致监听apollo变动获取不到内容。

我改成properties方式就正常了

@magestacks
Copy link
Member

你好

就是按照事例配置的,但是apollo非properties,namespaces需要加上后缀,如thread-pool.yml,这样ApolloRefresherHandler中Config config = ConfigService.getConfig(namespace)才会有内容;但是这样配置又导致configChangeListener中ConfigService.getConfigFile最后拼接的路径为thread-pool.yml.yml导致监听apollo变动获取不到内容。

我改成properties方式就正常了

@richardcode991

apollo:
namespace: thread-pool
config-file-type: yml

改成这样试试呢

@richardcode991
Copy link
Author

这样不行,这样ApolloRefresherHandler中Config config = ConfigService.getConfig(namespace)获取不到配置,导致监听注册不上去。

@magestacks
Copy link
Member

这样不行,这样ApolloRefresherHandler中Config config = ConfigService.getConfig(namespace)获取不到配置,导致监听注册不上去。

稍后我试下

@magestacks
Copy link
Member

@richardcode991 我对 apollo 不太熟悉,场景复现不出来。你有兴趣针对上述问题对 ApolloRefresherHandler 提个 PR 么

@magestacks magestacks added the type: bug Something isn't working label Mar 30, 2022
@magestacks magestacks added this to the 1.2.1 milestone Mar 30, 2022
@richardcode991
Copy link
Author

好的 后面我处理下

magestacks added a commit that referenced this issue Mar 30, 2022
@magestacks
Copy link
Member

今天会为 Core 发布一个新的 RC 版本。

<dependency>
    <groupId>cn.hippo4j</groupId>
    <artifactId>hippo4j-core-spring-boot-starter</artifactId>
    <version>1.2.0-RC1</version>
</dependency>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants