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

vmtool命令无法动态获取@ConfigurationProperties刷新后的值 #2967

Open
1 task
smallchips opened this issue Nov 29, 2024 · 1 comment
Open
1 task

Comments

@smallchips
Copy link

  • 我已经在 issues 里搜索,没有重复的issue。

环境信息

  • arthas-boot.jar 或者 as.sh 的版本: 4.0.4
  • Arthas 版本: 4.0.4
  • 操作系统版本: Debian GNU/Linux 8 (jessie)
  • 目标进程的JVM版本: openjdk version "1.8.0_111"
  • 执行arthas-boot的版本: 4.0.4

重现问题的步骤

  1. 配置文件
    @DaTa
    @RefreshScope
    @component
    @ConfigurationProperties(prefix = "trs")
    public class TrsConfig {
    private String openMock;
    }
  2. nacos上原来配置 trs.openMock 的值为 1
  3. nacos修改 trs.openMock 值为2,nacos动态刷新了,执行代码调用 trsConfig.getOpenMock(),postman返回为2,说明配置确实生效
  4. 使用 vmtool --action getInstances --className org.springframework.context.ConfigurableApplicationContext --express 'instances[0].getEnvironment().getProperty("trs.openMock")' 命令,获取的值还是1

期望的结果

vmtool --action getInstances --className org.springframework.context.ConfigurableApplicationContext --express 'instances[0].getEnvironment().getProperty("trs.openMock")' 命令,获取的值为2

实际运行的结果

实际运行结果,最好有详细的日志,异常栈。尽量贴文本。

把异常信息贴到这里
@WangJi92
Copy link
Contributor

@smallchips 这个需要看nacos的实现原理,你这里通过vmtool 直接获取 openMock 的值看一下 https://arthas.aliyun.com/doc/vmtool.html 用arthas 插件 执行一下
image

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

2 participants