fix: remove legacy commons logging from history runtime

This commit is contained in:
lingniu
2026-07-01 06:52:21 +08:00
parent 6ccf8fdc26
commit e03d1d7629
2 changed files with 22 additions and 0 deletions

View File

@@ -4,6 +4,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.io.ClassPathResource;
import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import static org.assertj.core.api.Assertions.assertThat;
@@ -109,6 +112,19 @@ class VehicleHistoryAppDefaultsTest {
|| name.equals("lingniu.ingest.sink.archive.path"));
}
@Test
void runtimeClasspathDoesNotContainLegacyCommonsLoggingJar() throws Exception {
List<String> logFactoryResources = Collections.list(Thread.currentThread()
.getContextClassLoader()
.getResources("org/apache/commons/logging/LogFactory.class"))
.stream()
.map(URL::toExternalForm)
.toList();
assertThat(logFactoryResources)
.noneMatch(resource -> resource.contains("/commons-logging-"));
}
private static Properties applicationProperties() {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(new ClassPathResource("application.yml"));