apolloconfig / apolloconfig/apollo

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

Offen
#1,993 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug kind/report-problem
Vorherrschende Sprache
Java
Sterne
29.8k
Forks
10.2k
Ø Merge
4 T. 7 Std.
Gemergte PRs (30 T.)
4

Beschreibung

使用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`设置属性操作,还望在修改此问题时评估其他属性是否有影响。

非常感谢!

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.