-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebClientConfig.java
More file actions
35 lines (28 loc) · 1.13 KB
/
WebClientConfig.java
File metadata and controls
35 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package DiffLens.back_end.global.web;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.reactive.function.client.WebClient;
@Configuration
public class WebClientConfig {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
public WebClient fastApiWebClient(@Value("${fast-api.url}") String baseUrl) {
return WebClient.builder()
.baseUrl(baseUrl)
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(10 * 1024 * 1024)) // 10MB
.build();
}
@Bean(name = "googleTokenWebClient")
public WebClient googleTokenWebClient(WebClient.Builder builder) {
return builder.baseUrl("https://oauth2.googleapis.com").build();
}
@Bean(name = "googleUserInfoWebClient")
public WebClient googleUserInfoWebClient(WebClient.Builder builder) {
return builder.baseUrl("https://www.googleapis.com").build();
}
}