alibaba / alibaba/switch-config

ClassLoader不一样会导致功能开关修改后无法生效

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
29
Forks
17
PR merge metrics
No merged PRs in 30d

Description

经过试验,发现在开发时依赖 `org.springframework.boot:spring-boot-devtools` 时,自己编写代码的ClassLoader是`RestartClassLoader`,但SwitchManager的ClassLoader是`AppClassLoader`,由于ClassLoader不一样,会导致功能开关修改后无法生效。

```xml

org.springframework.boot
spring-boot-devtools
runtime
true

```

打印ClassLoader信息:
```java
log.info(CommonTypeSwitch.class.getClassLoader().toString());
log.info(SwitchManager.class.getClassLoader().toString());
```

输出:
```text
2021-11-26 16:49:41.813 INFO 50082 --- [nio-8080-exec-8] c.s.p.a.a.c.CommonTypeSwitchController : org.springframework.boot.devtools.restart.classloader.RestartClassLoader@64edd270
2021-11-26 16:49:41.818 INFO 50082 --- [nio-8080-exec-8] c.s.p.a.a.c.CommonTypeSwitchController : sun.misc.Launcher$AppClassLoader@18b4aac2
```

建议在本工程文档或阿里云AHAS功能开关的文档中补充这种情况的说明。

Contributor guide

No contributing guide indexed for this repository

Research direction

No specific documentation file is named. Start by locating the project documentation and the Alibaba Cloud AHAS feature-switch documentation, then review where development-time limitations are described. Done means adding the reported Spring Boot DevTools ClassLoader mismatch and explaining that it can prevent feature-switch changes from taking effect.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.