apolloconfig / apolloconfig/apollo

关于使用springboot生成的war包部署到tomcat下配置读取错误的问题

Open
#1,993 4 comments 0 reactions 0 assignees View on GitHub
bug kind/report-problem
Dominant language
Java
Stars
29.8k
Forks
10.2k
Avg merge
4d 7h
Merged PRs (30d)
4

Description

使用springboot开发的项目,使用生成war包形式部署到tomcat下,如果部署多个,会出现 后启动的一直读取第一个启动的配置信息,导致配置读取错误或者项目启动失败,例如:
```
tomcat
|- A应用
|- appid配置:aa
|- B应用
|- appid配置:bb
```

如果A应用先启动,当B启动时,获取的appid是A的appid(即:aa,理论上应该是bb),
通过源码发现,使用spring boot 时会实现`EnvironmentPostProcessor.postProcessEnvironment`方法,其中会将appid等信息通过`System.setProperty`设置成进程全局属性,导致此问题,由于在项目中存在多处`System.setProperty`设置属性操作,还望在修改此问题时评估其他属性是否有影响。

非常感谢!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.