Skip to content

Commit

Permalink
chore: Profile 어노테이션으로 Product 모듈 feign client 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
clean2001 committed Oct 28, 2024
1 parent 59f658c commit a86a234
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import java.util.List;

@FeignClient(name = "live-service", configuration = FeignConfig.class)
public interface LiveFeign {

@PostMapping("/live/farm")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.samtuap.inong.common.client;

import org.samtuap.inong.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;

@Profile("local")
@FeignClient(name = "live-service", configuration = FeignConfig.class)
public interface LiveFeignLocal extends LiveFeign {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.samtuap.inong.common.client;


import org.samtuap.inong.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;

@Profile("prod")
@FeignClient(name = "live-service", url="http://live-service", configuration = FeignConfig.class)
public interface LiveFeignProd extends LiveFeign {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import java.util.List;

@FeignClient(name = "member-service", configuration = FeignConfig.class)

public interface MemberFeign {

@GetMapping(value = "/member/{id}")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.samtuap.inong.common.client;


import org.samtuap.inong.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;

@Profile("local")
@FeignClient(name = "member-service", configuration = FeignConfig.class)
public interface MemberFeignLocal extends MemberFeign {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.samtuap.inong.common.client;

import org.samtuap.inong.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;

@Profile("prod")
@FeignClient(name = "member-service", url = "http://member-service", configuration = FeignConfig.class)
public interface MemberFeignProd extends MemberFeign {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

import org.samtuap.inong.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.*;


import java.time.LocalDate;
import java.util.List;

@FeignClient(name = "order-service", configuration = FeignConfig.class)
public interface OrderFeign {

@GetMapping(value = "/order/package/top")
Expand All @@ -20,4 +19,4 @@ public interface OrderFeign {

@GetMapping("/delivery/farm/{farmId}/count")
Long getDeliveryCountByFarmId(@PathVariable Long farmId, @RequestParam("date") String date);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.samtuap.inong.common.client;

import org.samtuap.inong.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;

@Profile("local")
@FeignClient(name = "order-service", configuration = FeignConfig.class)
public interface OrderFeignLocal extends OrderFeign {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.samtuap.inong.common.client;

import org.samtuap.inong.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Profile;

@Profile("prod")
@FeignClient(name = "order-service", url="http://product-service", configuration = FeignConfig.class)
public interface OrderFeignProd extends OrderFeign {
}
6 changes: 3 additions & 3 deletions backend/product/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ spring:
port: 6379
host: 127.0.0.1
elasticsearch:
uris: ${SPRING.ELASTICSEARCH.URIS}
username: ${SPRING.ELASTICSEARCH.USERNAME}
password: ${SPRING.ELASTICSEARCH.PASSWORD}
uris: ${SPRING_ELASTICSEARCH_URIS}
username: ${SPRING_ELASTICSEARCH_USERNAME}
password: ${SPRING_ELASTICSEARCH_PASSWORD}

mail:
host: smtp.gmail.com
Expand Down

0 comments on commit a86a234

Please sign in to comment.