월 17,600원
5개월 할부 시다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
H2 console 에서의 문제
안녕하세요.먼저 좋은 수업을 강의 해주셔서 감사합니다!다름이 아니라 제가 해당 수업 진행 중 오류가 있어서 문의드립니다!mysql 콘솔에서는 오류가 발생 하지 않았으나,H2 Console 에서 테이블을 조회시 SELECT * FROM ORDERS;(conn=42) Table 'mydb.ORDERS' doesn't exist 42S02/1146 이러한 에러가 발생하는데 원인이 무엇일까요??order-service 에서 조회시에는 문제가 없습니다..
- 해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
GATEWAY-SERVICE 를 통하여 호출하지 않는 이유가 있을까요?
마이크로 서비스 사용간 (RestTemplate 혹은 Feign) 에서 Eureka 의 서비스 명으로 USER-SERVICE 같은 마이크로 서비스명을 통하여 직접 호출하면 결론적으로는 GATEWAY-SERVICE 를 통하여 사용했을때의 장점을 잃어버리는 것 같은데, 섹션 10 에서는 게이트웨이를 통하지 않고 직접 서비스를 호출하는 이유가 있을까요?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
MSA에서 데이터를 가져오는 방법
MSA에서 다른 어플리케이션의 데이터를 가져오는 방법으로 RestTemplate, FeignClient를 사용하는 방법을 알려주셨는데요.데이터를 가져오는 것은 보통 rest 통신을 사용하여 가져오나요?실무에서 카프카나 다른 라이브러리를 사용해서 가져오는지, 아니면 설명해주신 것 처럼 rest 통신을 통해 가져오는지 궁금합니다~
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Spring Security 최신버전(Spring Boot 3.X.X 대)의 WebSecurity 설정 공유드립니다.
최신버전으로 진행하다보니 막혔었는데요. 구글링, ChatGPT 등을 통해서 동작하는 코드 공유드립니다.정확한 구현은 아닐 수 있겠지만, 강의를 진행하는 데는 문제 없는 것 같습니다. 참고만 부탁드려요~ package com.example.userservice.security; import com.example.userservice.service.UserService; import lombok.RequiredArgsConstructor; import org.springframework.boot.autoconfigure.security.servlet.PathRequest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.ObjectPostProcessor; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.util.matcher.IpAddressMatcher; @Configuration @EnableWebSecurity @RequiredArgsConstructor public class WebSecurity { private final UserService userService; private final BCryptPasswordEncoder bCryptPasswordEncoder; private final ObjectPostProcessor<Object> objectPostProcessor; private static final String[] WHITE_LIST = { "/users/**", "/", "/**" }; @Bean protected SecurityFilterChain config(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().disable(); http.authorizeHttpRequests(authorize -> { try { authorize .requestMatchers(WHITE_LIST).permitAll() .requestMatchers(PathRequest.toH2Console()).permitAll() .requestMatchers(new IpAddressMatcher("127.0.0.1")).permitAll() .and() .addFilter(getAuthenticationFilter()); } catch (Exception e) { e.printStackTrace(); } } ); return http.build(); } public AuthenticationManager authenticationManager(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userService).passwordEncoder(bCryptPasswordEncoder); return auth.build(); } private AuthenticationFilter getAuthenticationFilter() throws Exception { AuthenticationFilter authenticationFilter = new AuthenticationFilter(); AuthenticationManagerBuilder builder = new AuthenticationManagerBuilder(objectPostProcessor); authenticationFilter.setAuthenticationManager(authenticationManager(builder)); return authenticationFilter; } } 이렇게 하시고 중요한 것이, Login Form을 사용하지 않기 때문에 AuthenticationFilter 클래스의 Override 메소드 중 successfulAuthentication 메소드 내부에super.successfulAuthentication(request, response, chain, authResult);코드가 작성되어 있다면, 아래처럼 제거 또는 주석 처리를 꼭 해야 합니다! (다른 질문 글에서 발견하였습니다, 공유 감사드립니다.)하지 않은 경우 에러가 발생하며 login 요청이 제대로 동작하지 않습니다. package com.example.userservice.security; import com.example.userservice.vo.RequestLogin; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import java.io.IOException; import java.util.ArrayList; public class AuthenticationFilter extends UsernamePasswordAuthenticationFilter { @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { try { RequestLogin creds = new ObjectMapper().readValue(request.getInputStream(), RequestLogin.class); return getAuthenticationManager().authenticate( new UsernamePasswordAuthenticationToken( creds.getEmail(), creds.getPassword(), new ArrayList<>() ) ); } catch (IOException e) { throw new RuntimeException(e); } } @Override protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException { //super.successfulAuthentication(request, response, chain, authResult); } }
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Config Client의 설정정보 업데이트 원리
안녕하세요. 강의 잘 듣고 있습니다. 강의를 듣던 중 아래 몇 가지 이해가 부족한 부분과 조언이 필요한 부분이 있어 이렇게 질문 남깁니다. 제가 이해하기로, Spring Cloud Config는 애플리케이션의 환경정보(이하 env)를 외부로부터 받아오기 위한 의존성이며, Spring Actuator의 /refresh는 단지 env를 업데이트 하기 위해 사용하는것 뿐이다. 둘 사이의 종속적인 부분은 없어보인다. 식으로 이해를 했습니다. 제가 생각한 것이 맞는지 궁금합니다. 혹은 참고해서 공부할 수 있는 키워드가 있다면 참고하여 학습하도록 하겠습니다. @Component 어노테이션으로 Spring Bean이 등록이 될 때, @Value 어노테이션을 통해 환경정보를 주입받을 수 있는 것을 알고 있습니다. 직접 확인을 해보니 /refresh는 Environment의 값은 바꾸지만, @Value를 통해 주입된 필드값은 수정되지 않음을 볼 수 있었습니다.Spring Cloud Config를 도입한다고 하면 @Value를 통해 주입받던 모든 곳을 Environment를 통해 가져오는 것으로 수정을 해야하는지 혹은 다른 해결방안이 있는지 궁금합니다. 감사합니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
보상 트랜잭션의 대한 후속 강의 문의합니다.
강의를 다 들어가는데요~ msa에서 예외가 발생 시 보상 트랜잭션의 대한 후속 강의를 제작한다고 들었습니다!해당 후속 강의는 정말 중요한 강의라고 생각되는데.. 언제쯤 업데이트 하실 계획이실까요?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
application.yml args에러발생이유
강의 잘 듣고있습니다~실습으로 따라하면서 하고있는데 application.yml에서 에러가 발생하는데 왜 그런것일까요??
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
스프링 시큐리티 문의 (webSecurityConfigurerAdapter 취소선)
안녕하세요. 스프링시큐리티 로그인관련 진행하다가 extends webSecurityConfigurerAdapter 가 취소선이 나와서 확인해보니 현재는 사용하지않는다고 알게되었습니다. 나름 바꾸면서 진행중인데authenticationManager() 를 사용하려면 어떻게해야되는지 알 수 있을까요?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
catalog 테이블 자동 create-drop 가 안됩니다.
안녕하세요 application.yml 설정을하고 서버 시작 시 CREATE문자체가 동작을안하는것같습니다.application.yml 과 CatalogEntity.java 는 다음과같습니다. 문제가무엇일까요...
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
H2 최신 버전 사용 시 server mode 사용에 따른 application.yml 파일 설정(테이블은 생성됐는데 data.sql INSERT 안될 시 참고)
Spring Boot 3.XX 대 버전으로 최신 버전 사용 시 H2를 이전 버전으로 사용 불가합니다.따라서 H2를 따로 켜서 실행해준 후, catalog-service에서 Server mode로 연결하던지 따로 켜 둔 H2를 연결하던지 선택해야합니다. 이 때, Server Mode로 프로젝트와 H2를 연결시키면 강의 내용의 설정만으로는 data.sql의 INSERT 쿼리문이 동작하지 않습니다. 그렇기 때문에 관련 설정을 application.yml에 추가해주어야 하는데요. 아래와 같이 설정하면 됩니다. stackoverflow와 강사님의 2021년 답변을 참고하여 해결하였습니다. server: port: 0 spring: application: name: catalog-service h2: console: enabled: true settings: web-allow-others: true path: /h2-console datasource: driver-class-name: org.h2.Driver url: jdbc:h2:tcp://localhost/mem:testdb username: sa jpa: hibernate: ddl-auto: create-drop show-sql: true generate-ddl: true defer-datasource-initialization: true sql: init: mode: always eureka: instance: instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}} client: register-with-eureka: true fetch-registry: true service-url: defaultZone: http://localhost:8761/eureka logging: level: com.example.catalogservice: DEBUG 추가한 내용은 spring.jpa.defer-datasource-initialization과 spring.sql.init.mode 설정입니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Kafka Docker-compose기동시 connect는 어떻게 설정하나요?
안녕하세요!Kafka Docker-compose기동시 connect는 어떻게 설정하나요?강의내용에는 이 부분이 생략된 것 같아서 질문합니다!
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
후속 강의 Webflux가 듣고 싶습니다.
강의를 듣다보니, Webflux 후속 강의를 준비하실 생각이 있다고 하셨는데, 계획이 있을까요?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Spring Boot 최신 3.XX 버전 Security 설정 공유드립니다.
최신 버전 진행하시는 분들을 위해 공유드립니다.Spring Security Configuration 설정 내용이 변경되었습니다. WebSecurityConfigurerAdapter 클래스가 deprecated되었는데요. 해당 클래스를 상속 받아 config 메소드를 구현하는 대신 SecurityFilterChain을 반환하고 직접 Bean으로 등록하도록 설정 방법이 바뀌었습니다. package com.example.userservice.security; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.web.SecurityFilterChain; @Configuration @EnableWebSecurity public class WebSecurity { private static final String[] WHITE_LIST = { "/users/**", "/**" }; @Bean protected SecurityFilterChain config(HttpSecurity http) throws Exception { http.csrf().disable(); http.headers().frameOptions().disable(); http.authorizeHttpRequests(authorize -> authorize .requestMatchers(WHITE_LIST).permitAll()); return http.build(); } } 강의 내용을 진행하기 위해서 강의에 나온 설정을 위처럼 설정해보았는데요. 일단 이렇게 설정하면 강의를 진행하는데 문제 없을 것이니 참고 바랍니다~
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
gradle
안녕하세요만약 9003번을 커맨드라인에서 gradle 명령어로 띄우려면 어떻게 해야하나요?
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
kafka 설정 관련해서 올려주신 goolge drive 링크가 만료되었습니다
Error: Could not find or load main class org.apache.kafka.connect.cli.ConnectDistributedCaused by: java.lang.ClassNotFoundException: org.apache.kafka.connect.cli.ConnectDistributedkafka connect 설정도중 위의 에러가 해결되지 않아 통합 파일을 받으려했는데 페이지를 찾을 수 없다고 나옵니다.https://www.inflearn.com/questions/601451/windows-kafka-%EC%A0%95%EC%83%81-%EC%9E%91%EB%8F%99%ED%95%98%EB%8A%94-%EB%B2%84%EC%A0%84-%EC%A0%9C%EA%B3%B5%EB%AC%B8%EC%9D%98https://drive.google.com/file/d/1GDrBskzAE4Y_GojNeXhGeN2YeMFrpFe-/view?usp=sharing링크 공유 다시해주시면 감사하겠습니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Order 서비스의 도메인
Order Service URL 주소에서IP:PORT/user/{user-id}/order 이렇게 주소를 주셨는데Restful API 에서 주문 도메인에 있는 정보를 유저 아이디 값으로 가져오고 싶을 때GET ip:port/order?user-id='' 로 가져와도 상관없을까요? 이게 API 디자인 가이드에 위배 되는 행위인지 궁금합니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
Actuator를 통해 앱을 재시작하지않고 DB 커넥션변경 가능할까요?
Actuator와 cloud bus라는 좋은 기능을 보면서 궁금증이 생겼습니다!이를 통해 자바 어플리케이션을 재시작하지않고 DB 커넥션변경 가능할까요??actuator로 db를 계속 변경 할 수 있으면 너무 좋을 것 같습니다!!
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
인증 관련해서 질문드립니다.
안녕하세요. 정말 유용한 강의 해주셔서 감사드립니다. 인증 처리 관련해서 궁금한점이 있어 질문 드려요!!궁금한점은 로그인 이외 요청에서는,AuthenticationFilter 를 통과하지 않고 진행되는 것인가요?.antMatchers("/**") .hasIpAddress("172.30.1.60") .and() .addFilter(getAuthenticationFilter()); 감사합니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
카프카에 잘못된 데이터를 보냈을 때 해결 방법이 궁금합니다
제가 처음에 json 파일을 아예 잘못된 형식으로 보내는 바람에 kafka sink connector가 fail 상태가 되었었습니다.근데 문제는 이 상태에서 sink connector를 재실행을 해도 source connector랑 sink connector, topic까지 모두 새로 만들어도 계속해서 task에 잘못 요청한 데이터가 남아있어서 아무리 오랜 시간을 기다려도 계속해서 Exception이 발생한 상태가 되어 있습니다..결국 한참을 구글링하면서 찾아보다가 토픽 내에 있는 메세지를 삭제하는 방법을 찾아서 해결했습니다 ㅜㅜ 여기서 제가 궁금한 점은source connector에 잘못된 정보를 보내는 바람에 sink connector가 먹통이 되어버리면 메세지나 토픽 자체를 수동으로 삭제해주는 것 외에는 방법이 없을까요? 구글을 찾아봐도 마땅한 방법을 찾지 못했습니다이건 제가 카프카에 대해 아직 똑바로 이해하지 못해서 나온 질문인데, connector랑 topic까지 모두 따로 만들어도 하나의 sink에서 문제가 생기면 모든 커넥터가 정상적으로 동작하지 않는 게 원래 이런 게 맞는 건지 궁금합니다. 감사합니다.
- 미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
파일들의 내용이 자꾸 과거로 돌아가는데 혹시 이런 현상 아시나요?
사용 환경은 맥, intellij입니다spring config 시작한 뒤로 이러는데yml파일이나 xml(메이븐)파일을 수정해놔도 어느 순간 이상해서 보면 수정 전으로 돌아가있습니다 ㅜㅜ인텔리제이 캐시도 초기화해봤고 git에도 올려서 커밋까지 했는데 왜이러는지 모르겠어요..강의랑은 무관한 질문인 것 같아서 망설이다가 이것 때문에 전혀 진도를 나가지 못하고 있는 상황이라 여쭤봅니다혹시 모르신다면 제가 알아서 잘 해결해보겠습니다! 불필요한 질문 드려 죄송합니다.