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

@nacosConfigListener Properties 类型转换失效 #302

Open
misaya98 opened this issue Jan 9, 2023 · 0 comments
Open

@nacosConfigListener Properties 类型转换失效 #302

misaya98 opened this issue Jan 9, 2023 · 0 comments

Comments

@misaya98
Copy link

misaya98 commented Jan 9, 2023

Issue Description

@NacosConfigListener Properties 类型转换失效

Type: bug report

Describe what happened (or what feature you want)

application.yml:

spring:
  config:
    import:
      - nacos:nacos-boot
  cloud:
    nacos:
      config:
        file-extension: yaml
        server-addr: 127.0.0.1:8848

code:

    @NacosConfigListener(dataId = "nacos-boot",type = ConfigType.YAML)
    public void onMessage(String configInfo){
        log.info("NacosConfigListener#String"+ configInfo);
    }
    @NacosConfigListener(dataId = "nacos-boot",type = ConfigType.YAML)
    public void onMessage1(Properties configInfo){
        log.info("NacosConfigListener#Properties"+ configInfo.toString());
    }

when changed the config from nacos,
output:

2023-01-09 21:06:01.333  INFO 14328 --- [onfigListener-1] c.e.c.controller.TestController          : NacosConfigListener#Stringuser:
  name: test-user
  age: 99
2023-01-09 21:06:01.578  INFO 14328 --- [ternal.notifier] c.a.c.n.c.NacosConfigDataLoader          : [Nacos Config] Load config[dataId=nacos-boot, group=DEFAULT_GROUP] success

expected output:

both  NacosConfigListener#String and  NacosConfigListener#Properties should be triggerd

Tell us your environment

spring cloud version : 2021.0.4
springboot version : 2.7.5
nacos version : 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant