Closed ankelen closed 5 years ago
提供下重现步骤
使用ApolloMockServerApiTest.java中的测试代码
public class Demo {
@ClassRule
public static EmbeddedApollo embeddedApollo = new EmbeddedApollo();
@Test
public void testGetProperty() throws Exception {
Config applicationConfig = ConfigService.getAppConfig();
assertEquals("value1", applicationConfig.getProperty("key1", null));
assertEquals("value2", applicationConfig.getProperty("key2", null));
}
}
看上去是你运行时的okhttp3的版本比较老所致,默认传递依赖的版本是3.11.0。
是的,我看到apollo-mockserver中依赖的okhttp和mockwebserver都是3.11.0,但是我引用到项目后,okhttp版变成了3.8.1
应该是被上层的dependencyManagement覆盖了,自己设置一下吧
嗯,自己设置是没问题。主要是被SpringCloud中的dependencyManagement覆盖掉了
22:17:15.663 [main] DEBUG com.ctrip.framework.apollo.internals.RemoteConfigRepository - Loading config from http://localhost:63125/configs/ApolloNoAppIdPlaceHolder/default/application?ip=192.168.0.112 Exception in thread "MockWebServer" java.lang.NoSuchFieldError: H2_PRIOR_KNOWLEDGE at okhttp3.mockwebserver.MockWebServer$3.processConnection(MockWebServer.java:488) at okhttp3.mockwebserver.MockWebServer$3.execute(MockWebServer.java:443) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)