sentry-java
sentry-java copied to clipboard
Auto configure OkHttp in Spring Boot
Problem Statement
Currently using Sentry with OkHttp on Spring Boot requires manual config.
Solution Brainstorm
We should check whether we can auto configure sentry-okhttp in case it's present on the classpath.
Looks like this needs to be added (automatically):
@Bean
OkHttpClient okHttpClient() {
return new OkHttpClient.Builder()
.addInterceptor(new SentryOkHttpInterceptor())
.eventListener(new SentryOkHttpEventListener())
.build();
}
We need to check if there's usually a bean already being created by Spring Boot and if there's a hook that allows us to configure that instance vs. creating a new instance as shown above.