From fe610d72dd5c766aed0d859bef8a3545673fd37e Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Tue, 20 Jul 2021 19:04:06 +0200 Subject: [PATCH] Remain binary compatible with OkHttp 3.x fixes #173 --- autoconfigure/build.gradle | 4 ++-- .../logging/OkHttp3LoggingInterceptorAutoConfiguration.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autoconfigure/build.gradle b/autoconfigure/build.gradle index 8214363..de1bf9e 100644 --- a/autoconfigure/build.gradle +++ b/autoconfigure/build.gradle @@ -37,8 +37,8 @@ dependencies { optional 'org.springframework:spring-web' - optional 'com.squareup.okhttp3:okhttp' - optional 'com.squareup.okhttp3:logging-interceptor' + optional 'com.squareup.okhttp3:okhttp:3.+' + optional 'com.squareup.okhttp3:logging-interceptor:3.+' testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' diff --git a/autoconfigure/src/main/java/io/freefair/spring/okhttp/logging/OkHttp3LoggingInterceptorAutoConfiguration.java b/autoconfigure/src/main/java/io/freefair/spring/okhttp/logging/OkHttp3LoggingInterceptorAutoConfiguration.java index 3438c15..e2a04fc 100644 --- a/autoconfigure/src/main/java/io/freefair/spring/okhttp/logging/OkHttp3LoggingInterceptorAutoConfiguration.java +++ b/autoconfigure/src/main/java/io/freefair/spring/okhttp/logging/OkHttp3LoggingInterceptorAutoConfiguration.java @@ -33,7 +33,8 @@ public HttpLoggingInterceptor okHttp3LoggingInterceptor( HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(actualLogger); - httpLoggingInterceptor.level(properties.getLevel()); + //noinspection deprecation + httpLoggingInterceptor.setLevel(properties.getLevel()); return httpLoggingInterceptor; }