Skip to content

Commit

Permalink
Merge pull request #21 from lotteon2/hotfix
Browse files Browse the repository at this point in the history
[FIX] yml
  • Loading branch information
wakkpu authored Jan 14, 2024
2 parents 6dbf612 + ebccd73 commit 7b1b486
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
package com.dailyon.auctionservice.config;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
@RequiredArgsConstructor
public class WebClientConfig {
@Value("${endpoint.product-service}")
private String endpoint;
private final Environment env;

@Bean
public WebClient webClient() {
return WebClient.builder()
.baseUrl(endpoint)
.baseUrl(env.getProperty("endpoint.product-service"))
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 *1024))
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.build();
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ eureka:
instance-id: ${spring.application.name}:${server.port}
# 기본적으로 유레카는 '호스트 이름'으로 접속하는 서비스를 레지스트리에 등록 -> 로컬(localhost)
# 따라서 쿠버네티스, 도커와 같이 임의의 호스트 이름을 가지는 경우는 false로 하면 클라이언트를 인식하지 못한다.
prefer-ip-address: true
prefer-ip-address: true

endpoint:
product-service: http://localhost:8085
2 changes: 1 addition & 1 deletion src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ eureka:
instance-id: ${spring.cloud.client.hostname}:${spring.application.instance_id:${random.value}}

endpoint:
product-service: localhost:8085
product-service: http://localhost:8085

cloud:
aws:
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ eureka:
instance-id: ${spring.application.name}:${server.port}
# 기본적으로 유레카는 '호스트 이름'으로 접속하는 서비스를 레지스트리에 등록 -> 로컬(localhost)
# 따라서 쿠버네티스, 도커와 같이 임의의 호스트 이름을 가지는 경우는 false로 하면 클라이언트를 인식하지 못한다.
prefer-ip-address: true
prefer-ip-address: true

endpoint:
product-service: http://product-service:8085
2 changes: 1 addition & 1 deletion src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ logging:
root: DEBUG

endpoint:
product-service: localhost:8085
product-service: http://localhost:8085

0 comments on commit 7b1b486

Please sign in to comment.