묻고 답해요
154만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
순위 정보를
불러오고 있어요
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
왜 요청에다가 AthenticFilter를 적용할까요?
apigateway의 application.yml을 보면 get요청에는 authorizationHeaderFilter를 적용시키고 있습니다. authenticFilter는 그저 로그인 요청시 attempthAuthentication메소드와 successfulAthentication메소드를 통해 인증을 처리하고 response헤더에 토큰을 추가하는 역할입니다. 따라서 로그인 요청에만 적용하면 될 것 같은데, 깃허브의 최신코드 버전을 보면 거의 모든 요청에 authenticationFilter를 적용하고 있습니다. 왜 로그인요청이 아닌 다른 요청에다가 AthenticFilter를 적용할까요? apiGateway-service에서 GET요청만 AuthoriztionFilter를 적용하면 되지않나요??http.authorizeHttpRequests((authz) -> authz .requestMatchers(new AntPathRequestMatcher("/actuator/**")).permitAll() .requestMatchers(new AntPathRequestMatcher("/h2-console/**")).permitAll() .requestMatchers(new AntPathRequestMatcher("/users", "POST")).permitAll() .requestMatchers(new AntPathRequestMatcher("/h2-console/**")).permitAll() // .requestMatchers(new AntPathRequestMatcher("/welcome/**")).permitAll() // .requestMatchers("/**").access(this::hasIpAddress) .requestMatchers("/**").access( new WebExpressionAuthorizationManager("hasIpAddress('127.0.0.1') or hasIpAddress('172.30.1.48')")) .anyRequest().authenticated() )
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
로그인까지는 되는데 /welcome에서 403 Forbidden 에러가 뜹니다.
안녕하세요. 깃허브에서 spring boot 3.2 브랜치통해 코드를 작성했습니다. 그런데 회원가입, 로그인까지 해서 jwt토큰까지는 잘 받아오는데, 그 이후에 /welcome으로 헤더에 토큰으로 추가해서 요청을 보내도 403 forbidden에러가 뜹니다. 코드는 spring boot 3.2 브랜치와 동일합니다.
-
해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
로그인시 No authorization header
안녕하세요 로그인시에는 인증이 필요하지가 않는데 자꾸 인증 해주는 AuthorizationHeaderFilter 클래스에서 apply 메소드에서 header 값이 없다고 걸립니다.그래서 아래와 같이 401 오류로 로그인이 안됩니다.application.yml 파일은 문제없는거 같은데 뭘 더 확인해봐야 할까요,,,?아래는 Users application.yml 파일입니다.
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
docker ex -it mariadb /bin/bash
docker ex -it mariadb /bin/bash이후에 mysql 명령어를 치면mysql: Command not found 에러가 나옵니다,.
-
해결됨모든 개발자의 실무를 위한 올인원 기본기 클래스
코드 github
실전프로젝트에서 사용한 코드를 볼수있는 github 주소가있을까요?? 제가 못찾는건가요 ㅠㅠ
-
미해결모든 개발자의 실무를 위한 올인원 기본기 클래스
alembic, dto 위치
안녕하세요!! alembic 을 적용할때는 infrastructure - database - alembic 폴더 이런식으로 구조짜면되는건가요?? 또 dto 는 어디에 위치해야하나요? dto, domain entity, orm entity 모두 필요한거아닌가요?!?! 강의에 dto 가 없어서 헷갈려서 질문드립니다...!! 혹시 domain entity 를 dto 개념으로 사용하신건가요??
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
왜 @Configuration의 WebSecurity 클래스에서 생성자 주입을 하지 않나요?
@Configuration@EnableWebSecuritypublic class WebSecurity { extends WebSecurityConfigurerAdapter { private UserService userService; private BCryptPasswordEncoder bCryptPasswordEncoder; private Environment env; public WebSecurity(Environment env, UserService userService, BCryptPasswordEncoder bCryptPasswordEncoder) { this.env = env; this.userService = userService; this.bCryptPasswordEncoder = bCryptPasswordEncoder; }강의에서 보면 @Configuration으로 WebSecurity클래스가 설정되어있기에 userService, bCryptPasswordEncoder, environment 인스턴스가 준비되어 있다고합니다. 따라서 위의 코드와 같이 생성자주입을 하지않는데, 왜 @Configuration으로 설정되어 있으면 @Autowired로 주입을 받지 않아도 되는 걸까요?
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
user-service에 로그인 404뜨는데 뭐가 문제일까요?
깃허브 코드대로 했습니다
-
해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
특정 dir로 위치를 잡으려면 어떻게 설정을 해야할까요
config를 root dir에 위치시킨게 아니라 특정 dir에 넣고 싶은데 그럴 때는 어떻게 uri를 잡아야하나요?
-
해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
jjwt 0.12 이상으로 하시는 분들에게..
jjwt가 버전업 되면서 강사님이 업데이트 해주신 코드들도 jwt valid할 때 안되는 경우가 발생하더라고요... 그래서 찾아본결과다음과 같이 작성하시면 원활하게 동작을 합니다. 참고하세요. private boolean isJwtValid(String jwt) { byte[] secretKeyBytes = Base64.getEncoder().encode(env.getProperty("token.secret").getBytes()); SecretKey signingKey = new SecretKeySpec(secretKeyBytes, SignatureAlgorithm.HS512.getJcaName()); boolean returnValue = true; String subject = null; try { JwtParser jwtParser = Jwts.parser(). verifyWith(signingKey).build(); Jws<Claims> claimsJws = jwtParser.parseSignedClaims(jwt); Claims payload = claimsJws.getPayload(); subject = payload.getSubject(); }catch (Exception ex){ returnValue = false; } if(subject == null || subject.isEmpty()){ returnValue = false; } return returnValue; }
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
config-servie 도커로 실행 시 에러 문의
안녕하세요."섹션 16. 애플리케이션 배포 - Docker Container"을 학습하면서 config-service를 Docker로 만들어 실행하면 컨테이너 실행 됐다가 Exit가 되고, "docker logs config-service"로 로그를 보면 아래와 에러가 발생합니다. JDK11 , springboot 2.4.5 버전에 spring-cloud-starter-bootstrap 의존성은 추가 되어 있는 상태입니다. 답변 부탁드립니다. 감사합니다.===================================================================2024-03-22 06:50:22.104 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'configServerHealthIndicator' defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method 'configServerHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.CompositeConfiguration': Unsatisfied dependency expressed through method 'setEnvironmentRepos' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository.2024-03-22 06:50:22.113 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'2024-03-22 06:50:22.117 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]2024-03-22 06:50:22.134 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.2024-03-22 06:50:22.149 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :***************************APPLICATION FAILED TO START***************************Description:Invalid config server configuration.Action:If you are using the git profile, you need to set a Git URI in your configuration. If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.===================================================================
-
해결됨실무에서 꼭 필요한 서버 모니터링(Zabbix)
깃허브 링크가 필요해요
깃허브를 사용하실꺼면 깃허브 링크라도 찾을 수 있게 해주세요
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
AuthenticationFilter 관련 질문
안녕하세요 강사님 좋은 강의 정말 감사드립니다.user service에서 어떤 요청이 들어오든 AuthenticationFilter 를 거치게 되는 것으로 알고 있는데 login 요청을 제외한 다른 요청들은(ex: health-check, welcome 등) AuthenticationFilter 에 존재하는 attemptAuthentication과 loadUserByUsername 메소드는 실행되지 않고 바로 필터가 통과되는 것인가요? 해당 질문은 msa 라기보다 시큐리티 관련 내용인 것 같아 여기에 질문하는 것이 좀 죄송한데 답변 주시면 정말 감사드리겠습니다. 감사합니다!
-
미해결AWS 클라우드 이해와 실습
Web App의 정확한 의미
안녕하세요 선생님!단어의 의미로 제가 이해하는데 약간의 혼동이 있는것 같아 이를 확실하게 하기위해 질문드립니다! 제가 알기로 vue.js등으로 구현된 애플리케이션도 강의에서 설명해주신 앱처럼 JSON형태의 데이터를 주고 받는것으로 알고 있습니다! 혹시 Web App은 타임리프나 JSP와 같은 뷰템플릿 엔진을 활용하여 서버에서 HTML을 응답하는것을 의미하신것일까요?Web App을 검색해보니 서버와 Json형태의 데이터를 주고받는 화면도 의미하는것 같아 좀 혼동이 되어서 질문드렸습니다! 감사합니다.
-
미해결Microservice 이해 (with MSA패턴)
모듈형 모노리스의 컨테이너화
모듈형 모노리스도 컨테이너화 할 수 있다. 쿠버네티스의 꼭 마이크로서비스만 올리는게 아닌 모노리스도 그냥 올릴 수 있다. 그것만으로도 확장성,배포성,탄력성이 보장이 되기도 한다. 라고 하셨었는데이 부분에대해서 조금 더 상세하게 알고싶어서 질문드립니다. 확장성,배포성,탄력성 부분에서 어떤 장점들이 있는지 조금 더 디테일하게 궁금합니다.그렇다면 모노리스 서버 구조의 아키텍처 설계 대신에 항상 쿠버네티스를 쓰는게 좋지 아니한가해서 질문드립니다.
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
KafkaListener DB에서 update 나 delete 이벤트 감지하는방법있을까요?
카프라 활용 1~2를 보면서 궁금한 점이 생겼는데DB서 insert 가 발생했을 때는 @KafkaListener 를 통해 생성된 데이터를 받을 수 있는데 update나 delete 가 발생했을 때는 @KafkaListener로 받을 수 없더라고요?DB에서 update또는 delete문이 발생했을 때의 이벤트도 받으려면 어떻게 해야할까요?
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
카프카를 통해 다른 서비스의 데이터를 수정하는 과정에서 예외가 발생했을 경우처리하는 방법이 궁금합니다.
두개의 Service가 통신할 때 예외처리 시나리오A, B 서비스가 있을 때 A 서비스에서 B 서비스로 데이터를 수정 또는 생성하는 요청을 했는데 이 때 개발자가 의도해서 예외를 발생시켰던 예상치못한 예외가 발생했던 간에 예외가 발생해서 B서비스의 데이터를 수정하지 못하는 경우라면 A서비스는 어떻게 롤백시켜주나요? 1번 시나리오에서 하나의 서비스가 추가되어 3개의 Service가 통신할 때 예외처리 시나리오A서비스에서 B 서비스를 수정 or 생성 하고 C서비스를 수정 or 생성하는 시나리오일 경우 만약에 B서비스에 요청을 했을 때는 성공을하고 C서비스에 요청을 했을 때 실패를 했다면 A서비스로 롤백시켜줘야하고 B서비스도 롤백을 시켜주어야할텐데 이 경우에는 어떻게 롤백처리를 해주나요??구글해보니 그냥 추상적으로 오케스트레이션 Saga패턴? 그런걸로 처리한다는데 막연하게 글로만 설명있고 어떤 소프트웨어를 설치해서 코드를 짜면된다 이런건 없어서 어떻게 처리되어야하는건지 감을 못잡겠네요ㅠㅠ. Axon 서버 뭐 이런것도 본거 같기도 하고요.
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
이번 강의에 있는 모든 테스트가 작동되지 않습니다.
이번 영상에서 진행하신 모든 테스트가 작동되지 않는데 에러페이지 조차 뜨질 않아서 어떠한 오류인지 확인이 불가능하여 잘못된 점을 찾지 못하고 있습니다.일단 Eureka 페이지에서 user-service를 클릭하면 저는 localhost로 실행이되면서 실행권한이 없다며 접속이 불가능합니다. security filter에 걸렸나 싶었지만 그 어떤 프로젝트 파일에서도 console에 아무런 메세지가 뜨지 않습니다. 강사님께서는 따로 설정하신것이 있으실까요?왜 저는 localhost로 가고 강사님은 실제 ip주소로 실행되는지 이유를 잘 모르겠습니당ㅠㅠ user-ms 실행하면 Fetching이 127.0.0.1:8888로 걸리는 것 까지는 잘 되는데 그 이후에 health_check를 하고자 user-service 페이지를 여는 것부터 안됩니다ㅠㅠ
-
해결됨Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
ZIPKIN에서 오류 나시는분들
Spring 3버전대에서 zipkin 설정이 바뀌면서 # zipkin: # base-url: http://13.124.192.188:9411 # enabled: true이 부분을 주석처리하고management: tracing: sampling: probability: 1.0 propagation: type: b3 zipkin: tracing: endpoint: "http://localhost:9411/api/v2/spans"위와 같이 설정하였다면 docker run 할때 문제가 생길 수 있습니다! 해당 내용을 토대로 환경변수를 주고 실행을 시켜야 합니다(저도 깜빡하고 왜 오류나지 고민만 했는데.. 설정을 바꿨었더라구요!)user-service docker rundocker run -d --network ecommerce-network \ --name user-service \ -e "spring.cloud.config.uri=http://config-server:8888" \ -e "spring.rabbitmq.host=rabbitmq" \ -e "management.zipkin.tracing.endpoint=http://zipkin:9411/api/v2/spans" \ -e "eureka.client.serviceUrl.defaultZone=http://discovery-service:8761/eureka/" \ -e "logging.file=/api-logs/users-ws.log" \ kimtaeheon/user-service:1.0order-service docker rundocker run -d --network ecommerce-network \ --name order-service \ -e "spring.cloud.config.uri=http://config-server:8888" \ -e "spring.rabbitmq.host=rabbitmq" \ -e "management.zipkin.tracing.endpoint=http://zipkin:9411/api/v2/spans" \ -e "eureka.client.serviceUrl.defaultZone=http://discovery-service:8761/eureka/" \ -e "spring.datasource.url=jdbc:mariadb://mariadb:3306/mydb" \ -e "logging.file=/api-logs/orders-ws.log" \ kimtaeheon/order-service:1.0
-
미해결Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)
mariadb 접속 관련해서 질문 있습니다.
강의에서 권한을 주는 부분을 보기 전에 작성해주신 아래와 같은 Dockerfile을 사용하였을 경우 실행이 되지 않았습니다.1번FROM mariadb ENV MYSQL_ROOT_PASSWORD rlaxogjs8312 ENV MYSQL_DATABASE mydb COPY ./mysql_data/mysql /var/lib/mysql EXPOSE 3306그래서 저는 복사하는 폴더가 문제인가 해서 COPY부분을 아래와 같이 바꿔서 mydb만을 복사하도록 하였습니다.2번FROM mariadb ENV MYSQL_ROOT_PASSWORD rlaxogjs8312 ENV MYSQL_DATABASE mydb COPY ./mysql_data/mysql/mydb /var/lib/mysql EXPOSE 3306이렇게 하였더니 db가 제대로 복사가 되지는 않았지만 로컬에서 접속이 가능하였습니다.그래서 왜 복사가 안되는거지.. 고민하다가 나머지 강의를 듣고 다시 1번으로 빌드 후 실행한 뒤에는 복사도 잘 되었음을 확인하였습니다.궁금한 점은 다음과 같습니다.왜 2번 Dockerfile의 경우 복사는 제대로 되지 않았는데 로컬호스트에서 DB에 접속이 가능했었던 건지 궁금합니다.만약 COPY가 아니라 VOLUME을 적용해서 한 과거 기억을 되살려보면 권한은 문제가 없었던 것 같은데 권한은 해당 Docker Container에 어떤 이유때문에 적용해야하는 것인지 궁금합니다.
주간 인기글
순위 정보를
불러오고 있어요