Closed JBlazingSun closed 2 years ago
再次测试了下 换回springboot 2.6.10 pom :
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.9</version>
</dependency>
这样设置是正常运行的
换成springboot 2.7.2 pom : com.github.lianjiatech retrofit-spring-boot-starter 2.3.6
报错如下:
2022-08-08 16:30:48.159 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : --> GET http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp 2022-08-08 16:30:48.159 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : --> END GET 2022-08-08 16:30:48.362 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : <-- 200 OK http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp (202ms) 2022-08-08 16:30:48.362 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : Server: nginx 2022-08-08 16:30:48.362 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : Date: Mon, 08 Aug 2022 08:30:48 GMT 2022-08-08 16:30:48.363 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : Content-Type: application/json;charset=UTF-8 2022-08-08 16:30:48.363 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : Connection: keep-alive 2022-08-08 16:30:48.363 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : Content-length: 109 2022-08-08 16:30:48.363 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : x-paramkey: mtop.common.getTimestamp 2022-08-08 16:30:48.363 INFO 9208 --- [ main] c.g.l.r.s.boot.log.LoggingInterceptor : s-rt: 0
java.lang.NoSuchMethodError: 'boolean okhttp3.internal.http.HttpHeaders.promisesBody(okhttp3.Response)'
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:241)
at com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor.intercept(LoggingInterceptor.java:38)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at com.github.lianjiatech.retrofit.spring.boot.retry.RetryInterceptor.retryIntercept(RetryInterceptor.java:64)
at com.github.lianjiatech.retrofit.spring.boot.retry.RetryInterceptor.intercept(RetryInterceptor.java:44)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at com.github.lianjiatech.retrofit.spring.boot.interceptor.ErrorDecoderInterceptor.intercept(ErrorDecoderInterceptor.java:40)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
at okhttp3.RealCall.execute(RealCall.java:81)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:204)
at com.github.lianjiatech.retrofit.spring.boot.core.BodyCallAdapterFactory$BodyCallAdapter.adapt(BodyCallAdapterFactory.java:83)
at retrofit2.HttpServiceMethod$CallAdapted.adapt(HttpServiceMethod.java:165)
at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146)
at retrofit2.Retrofit$1.invoke(Retrofit.java:160)
at com.sun.proxy.$Proxy68.getTime(Unknown Source)
at com.blazings.suanfa.component.retrofit.HelloRetrofitClientTest.getTime(HelloRetrofitClientTest.java:20)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
看起来还是okhttp版本不对,试试引入完整依赖:
<dependency>
<groupId>com.github.lianjiatech</groupId>
<artifactId>retrofit-spring-boot-starter</artifactId>
<version>2.3.6</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.14.9</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.9</version>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.17.5</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-jackson</artifactId>
<version>2.9.0</version>
</dependency>
oki依赖冲突导致,2.3.7版本已解决,烦请试试。
测试过了, springboot 2.3.7, retrofit-spring-boot-starter 2.3.7 正常运行,
但启动有警告
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by retrofit2.Platform (file:/C:/code/mavenrepo/com/squareup/retrofit2/retrofit/2.9.0/retrofit-2.9.0.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) WARNING: Please consider reporting this to the maintainers of retrofit2.Platform WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
这个是警告对实际运行无影响。
原因是在Java8以上版本进行了反射调用,并且是在Retrofit底层调用的,现有组件无法处理掉。
发件人: @.> 代表 blazings @.> 答复: LianjiaTech/retrofit-spring-boot-starter @.> 日期: 2022年9月7日 星期三 下午12:28 收件人: LianjiaTech/retrofit-spring-boot-starter @.> 抄送: chentianming @.>, State change @.> 主题: Re: [LianjiaTech/retrofit-spring-boot-starter] 2.3.6 retrofit-spring-boot-starter不支持springboot2.7.0以上版本 (Issue #123)
测试过了, springboot 2.3.7, retrofit-spring-boot-starter 2.3.7 正常运行,
但启动有警告
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by retrofit2.Platform (file:/C:/code/mavenrepo/com/squareup/retrofit2/retrofit/2.9.0/retrofit-2.9.0.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) WARNING: Please consider reporting this to the maintainers of retrofit2.Platform WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>
springboot 2.7 还是报错
2022-11-12 00:35:38.726 WARN 41516 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retrofitConfigBean' defined in class path resource [com/github/lianjiatech/retrofit/spring/boot/config/RetrofitAutoConfiguration.class]: Unsatisfied dependency expressed through method 'retrofitConfigBean' parameter 5; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 2022-11-12 00:35:39.047 INFO 41516 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closing ... 2022-11-12 00:35:39.050 INFO 41516 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed 2022-11-12 00:35:39.061 INFO 41516 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-11-12 00:35:39.075 ERROR 41516 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Parameter 5 of method retrofitConfigBean in com.github.lianjiatech.retrofit.spring.boot.config.RetrofitAutoConfiguration required a bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' that could not be found.
Action:
Consider defining a bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' in your configuration.
retrofit-spring-boot-starter 升级到最新版本还报错吗?
这个看起来是LoggingInterceptor没有正常注入,但是这个bean在RetrofitAutoConfiguration是有相关定义的。 根据目前的日志,没法定位到具体原因,麻烦提供完整的日志。
------------------ 原始邮件 ------------------ 发件人: "LianjiaTech/retrofit-spring-boot-starter" @.>; 发送时间: 2022年11月12日(星期六) 凌晨0:37 @.>; @.>;"State @.>; 主题: Re: [LianjiaTech/retrofit-spring-boot-starter] 2.3.6 retrofit-spring-boot-starter不支持springboot2.7.0以上版本 (Issue #123)
springboot 2.7 还是报错
2022-11-12 00:35:38.726 WARN 41516 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retrofitConfigBean' defined in class path resource [com/github/lianjiatech/retrofit/spring/boot/config/RetrofitAutoConfiguration.class]: Unsatisfied dependency expressed through method 'retrofitConfigBean' parameter 5; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 2022-11-12 00:35:39.047 INFO 41516 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closing ... 2022-11-12 00:35:39.050 INFO 41516 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed 2022-11-12 00:35:39.061 INFO 41516 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-11-12 00:35:39.075 ERROR 41516 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Parameter 5 of method retrofitConfigBean in com.github.lianjiatech.retrofit.spring.boot.config.RetrofitAutoConfiguration required a bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' that could not be found.
Action:
Consider defining a bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' in your configuration.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>
也可能是你系统里面已经有了同名的loggingInterceptor Bean实例导致的。
你可以试试手动定义一下: @Bean("retrofitLoggingInterceptor") public LoggingInterceptor loggingInterceptor() { return new LoggingInterceptor(retrofitProperties.getGlobalLog()); }
------------------ 原始邮件 ------------------ 发件人: "LianjiaTech/retrofit-spring-boot-starter" @.>; 发送时间: 2022年11月12日(星期六) 凌晨0:37 @.>; @.>;"State @.>; 主题: Re: [LianjiaTech/retrofit-spring-boot-starter] 2.3.6 retrofit-spring-boot-starter不支持springboot2.7.0以上版本 (Issue #123)
springboot 2.7 还是报错
2022-11-12 00:35:38.726 WARN 41516 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'retrofitConfigBean' defined in class path resource [com/github/lianjiatech/retrofit/spring/boot/config/RetrofitAutoConfiguration.class]: Unsatisfied dependency expressed through method 'retrofitConfigBean' parameter 5; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 2022-11-12 00:35:39.047 INFO 41516 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closing ... 2022-11-12 00:35:39.050 INFO 41516 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed 2022-11-12 00:35:39.061 INFO 41516 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-11-12 00:35:39.075 ERROR 41516 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Parameter 5 of method retrofitConfigBean in com.github.lianjiatech.retrofit.spring.boot.config.RetrofitAutoConfiguration required a bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' that could not be found.
Action:
Consider defining a bean of type 'com.github.lianjiatech.retrofit.spring.boot.log.LoggingInterceptor' in your configuration.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>
2022-08-07 22:18:39.069 WARN 29032 --- [ restartedMain] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sourceOkHttpClientRegistry' defined in class path resource [com/github/lianjiatech/retrofit/spring/boot/config/RetrofitAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.lianjiatech.retrofit.spring.boot.core.SourceOkHttpClientRegistry]: Factory method 'sourceOkHttpClientRegistry' threw exception; nested exception is java.lang.NoSuchFieldError: Companion 2022-08-07 22:18:39.078 INFO 29032 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-08-07 22:18:39.123 ERROR 29032 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sourceOkHttpClientRegistry' defined in class path resource [com/github/lianjiatech/retrofit/spring/boot/config/RetrofitAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.lianjiatech.retrofit.spring.boot.core.SourceOkHttpClientRegistry]: Factory method 'sourceOkHttpClientRegistry' threw exception; nested exception is java.lang.NoSuchFieldError: Companion at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.20.jar:5.3.20] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.20.jar:5.3.20] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-2.7.0.jar:2.7.0] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-2.7.0.jar:2.7.0] at com.blazings.suanfa.SuanfaApplication.main(SuanfaApplication.java:16) ~[classes/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.0.jar:2.7.0] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.lianjiatech.retrofit.spring.boot.core.SourceOkHttpClientRegistry]: Factory method 'sourceOkHttpClientRegistry' threw exception; nested exception is java.lang.NoSuchFieldError: Companion at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.20.jar:5.3.20] ... 23 common frames omitted Caused by: java.lang.NoSuchFieldError: Companion at okhttp3.internal.Util.(Util.kt:70) ~[okhttp-4.9.3.jar:na]
at okhttp3.OkHttpClient.(OkHttpClient.kt:1073) ~[okhttp-4.9.3.jar:na]
at com.github.lianjiatech.retrofit.spring.boot.core.SourceOkHttpClientRegistry.(SourceOkHttpClientRegistry.java:27) ~[retrofit-spring-boot-starter-2.3.6.jar:na]
at com.github.lianjiatech.retrofit.spring.boot.config.RetrofitAutoConfiguration.sourceOkHttpClientRegistry(RetrofitAutoConfiguration.java:73) ~[retrofit-spring-boot-starter-2.3.6.jar:na]
at com.github.lianjiatech.retrofit.spring.boot.config.RetrofitAutoConfiguration$$EnhancerBySpringCGLIB$$e630bed7.CGLIB$sourceOkHttpClientRegistry$4() ~[retrofit-spring-boot-starter-2.3.6.jar:na]
at com.github.lianjiatech.retrofit.spring.boot.config.RetrofitAutoConfiguration$$EnhancerBySpringCGLIB$$e630bed7$$FastClassBySpringCGLIB$$93a0271d.invoke() ~[retrofit-spring-boot-starter-2.3.6.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.20.jar:5.3.20]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.20.jar:5.3.20]
at com.github.lianjiatech.retrofit.spring.boot.config.RetrofitAutoConfiguration$$EnhancerBySpringCGLIB$$e630bed7.sourceOkHttpClientRegistry() ~[retrofit-spring-boot-starter-2.3.6.jar:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.20.jar:5.3.20]
... 24 common frames omitted
与目标 VM 断开连接, 地址为: ''127.0.0.1:59215',传输: '套接字''
进程已结束,退出代码0