aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/configuration/ActivityPubClientConfig.java
blob: 43b638fe2cf7308d2c28ab69b796f5ba98992de5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package com.juick.server.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

import javax.inject.Inject;

@Configuration
public class ActivityPubClientConfig {
    @Inject
    ActivityPubClientErrorHandler activityPubClientErrorHandler;
    @Bean
    public RestTemplate apClient() {
        RestTemplate restTemplate = new RestTemplate(new OkHttp3ClientHttpRequestFactory());
        restTemplate.setErrorHandler(activityPubClientErrorHandler);
        return restTemplate;
    }
}