alibaba / alibaba/arthas

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

Open
#2,967 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
37.5k
Forks
7.6k
Avg merge
1d 22h
Merged PRs (30d)
4

Description

- [ ] 我已经在 [issues](https://github.com/alibaba/arthas/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;
}
3. nacos上原来配置 trs.openMock 的值为 1
4. nacos修改 trs.openMock 值为2,nacos动态刷新了,执行代码调用 trsConfig.getOpenMock(),postman返回为2,说明配置确实生效
5. 使用 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

### 实际运行的结果

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

```
把异常信息贴到这里
```

Contributor guide

Open the contributing guide

Research direction

Start with the vmtool getInstances command targeting ConfigurableApplicationContext and the expression reading getEnvironment().getProperty("trs.openMock"). Compare that value with the @RefreshScope and @ConfigurationProperties refresh behavior described in the reproduction. Done means the command returns 2 after Nacos changes trs.openMock from 1 to 2.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.