묻고 답해요
156만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결옆집 개발자와 같이 진짜 이해하며 만들어보는 첫 Spring Boot 프로젝트
향후 강의 일정에 대해 문의드립니다!
안녕하세요! 미리 1탄부터 1.5탄 구매했고요, 2탄도 구매해서 수강예정입니다, 강의가 넘 재밌고 이해가 쉽습니다! 강사님이 웃으실 때 저도 덩달아 따라 웃게되네요 ^___^;;앞으로 MSA 기반 Spring Cloud와 MSA 인프라 구현을 위한 도커 및 쿠버네티스도 강의 신청 드려도 되는 지 문의드립니다!현재 강사님의 현업 업무 경험으로 MSA 와 Spring Cloud가 백엔드 취업에 어떠한 도움이 되는 지 궁금합니다!그리고 JPA vs MyBatis 중에 현재 백엔드 취업 시장에서 강사님의 Pick이 어떠한 지 궁금합니다! 모든 기술을 통합하고 융합한 백엔드 취업용 초보 신입 개발자 포트폴리오용 프로젝트 강의를 언제쯤 출시해주시는 지 문의드립니다!
-
해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
2개 이상의 마이크로 서비스가 결합됐을 때는 테스트코드는 어떻게 작성하는지 궁금합니다.
UserService API 를 호출할때 RestTemplate 를 통해 OrderService 의 API 를 추가로 호출하는 방법을 보고 각 마이크로 서비스들이 엔티티 단위로 모듈화 되어 설계되어있다면 이런식으로 하는구나~ 배울 수 있었습니다. 그런데 이렇게 두개 이상의 마이크로서비스가 호출되는 API 는 테스트 코드를 어떻게 작성해야 하는지 감이 잡히지 않습니다. Web Layer(Controller) 를 테스트할때는 Service 객체를 Mocking 해서 해결할 수 있을것 같은데, Service layer(Service 클래스) 를 테스트할때는 어떻게 해야할까요?
-
해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
api-gateway 서버를 실행시키고 first-service와 second-service 를 실행시키면 api-gateway가 실행이 잘 안됩니다.
안녕하세요 Spring Cloud Gateway 프로젝트 생성 강의를 진행했는데요 제가 first-service와 second-service 그리고 api-gateway를 모두 Spring Boot 2.6.10 버전 java 11 버전 sdk도 11 로 생성했습니다. 우선 api-gateway의 application.yml 파일은 다음과 같습니다. server: port: 8000eureka: client: register-with-eureka: false fetch-registry: false service-url: defaultZone: http://localhost:8761/eurekaspring: application: name: apigateway-service cloud: gateway: routes: - id: first-service uri: http://localhost:8081/ # 여기로 요청할거다. predicates: # 조건절이다. - Path=/first-service/** # 사용자가 이걸호출하면 위에 uri로 간다. 즉 http://localhost:8081/first-service/** 으로 간다. - id: second-service uri: http://localhost:8082/ # 여기로 요청할거다. predicates: # 조건절이다. - Path=/second-service/** # 사용자가 이걸호출하면 위에 uri로 간다. first-service의 application.yml 파일은 다음과 같고 server: port: 8081spring: application: name: my-first-serviceeureka: client: fetch-registry: false register-with-eureka: false FirstServiceController는 다음과 같습니다. @RestController@RequestMapping("/first-service")public class FirstServiceController { @GetMapping("/welcome") public String welcome() { return "Welcome to the First service"; }} 또한 second-service의 application.yml은 다음과 같고 server: port: 8082spring: application: name: my-second-serviceeureka: client: fetch-registry: false register-with-eureka: false SecondServiceController는 다음과 같습니다. @RestController@RequestMapping("/second-service")public class SecondServiceController { @GetMapping("/welcome") public String welcome() { return "Welcome to the Second service"; }} 브라우저에 http://127.0.0.1:8081/first-service/welcome 을 입력하면 Welcome to the First service가 잘뜨고 http://127.0.0.1:8082/second-service/welcome 을 입력하면 Welcome to the Second service 가 잘 뜹니다. 그런데 http://127.0.0.1:8000/first-sevice/welcome http://127.0.0.1:8000/second-sevice/welcome 을 입력하면 역시나 동일하게 Welcome to the ~ 가 나와야하는데 Whitelabel Error Page 404 에러가 발생합니다... 원인이 무엇일까요? 참고로 api-gateway 서버를 먼저키고 first, second 켜보기도하고 first, second 서버 먼저 키고 api-gateway를 켜보기도했는데 상관없이 똑같은 에러가 발생합니다.
-
해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Spring Cloud Gateway & Spring Cloud Load Balancer 질문
안녕하세요 강사님 강의를 보면서 많은 도움이 되었습니다. Spring Cloud Gateway - Load Balancer 1,2 강의를 보고나서 궁금한 점이 있어서 글을 남깁니다. 강의에서 보면 Spring Cloud Gateway에서 load balance를 처리하셨는데, 따로 Spring Cloud Load Balancer 의존성 추가없이, 단지 lb://MY-FIRST-SERVICE로만 처리하여 Load balance 기능이 작동되는 것을 확인했습니다. 그렇다면 Spring Cloud Load Balancer가 Spring cloud Gateway 안에 내장되어 있는건가요? 아니면 Spring Cloud Load Balancer는 완전히 다른 모듈이고, Spring Cloud Gateway안에 있는 독자적인 loadbalance기능이 있다고 생각해야되는 걸까요? 만약 내장되어 있다면, 강의에 있는 프로젝트와 같은 상황에서 Spring Cloud Load Balancer를 따로 처리할 필요가 없는건가요? Spring Cloud Load Balancer의 용도에 대해서 고민이 되어 글을 남깁니다. 감사합니다.