전체 글 795

[Error] - java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class

[문제 상황] java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class - 레포지토리 유닛테스트 진행 중 마주한 예외 [문제 해결] @DataJpaTest와 @SpringbootTest 두개 애너테이션을 같이 사용하는 발생하는 예외이다. 둘 중 하나를 삭제하고 사용하면 해당 문제는 해결된다.

[Error] - 배치 서버를 시작할 때 리스너와 관련된 오류

[문제 원인] The method [onWriteError] on target class [ModifyInactiveMemberListener] is incompatible with the signature [(Exception, Chunk)] expected for the annotation [OnWriteError]. 배치 서버를 작업하던 도중 step에 등록한 리스너가 문제를 일으켰다. 이 에러 메시지는 ModifyInactiveMemberListener 클래스에 @OnWriteError 어노테이션이 붙은 onWriteError 메소드가 존재하지만, 해당 메소드의 시그니처가 @OnWriteError 어노테이션에서 기대하는 시그니처와 일치하지 않음을 나타냅니다. 해당 예외와 메소드 인자를 맞춰야 한다..

[Error] - 빈생성 중복 문제

[문제 상황] Description: The bean 'scopedTarget.listItemReader', defined in class path resource [com/yaloostore/batch/member/step/ModifyInactiveMemberStep.class], could not be registered. A bean with that name has already been defined in class path resource [com/yaloostore/batch/member/step/BirthDayCouponStep.class] and overriding is disabled. 해당 이름으로 등록된 빈이 이미 있으니까 다른 이름을 써라 ~ 하는 의미이지만 yml, propert..

[Error] - Query parameters with the following names were not documented: [_csrf] 스프링 시큐리티 환경에서 테스트 작업과 Spring rest Doc을 이용한 문서화 작업을 하면 생기는에러

[문제 상황] 스프링 시큐리티 환경에서 컨트롤러 레이어의 유닛 테스트 진행에 발생할 수 있는 문제 이 문제는 query string(=query parameter)으로 넘어오는 파라미터에 대해서 발생할 수 있는 상황인듯 싶다.(Pathvariable을 사용했을 땐 이런 일이 없었음) Query parameters with the following names were not documented: [_csrf] [시큐리티 환경에서의 컨트롤러 레이어 테스트 작업 코드] ResultActions perform = mockMvc.perform(get("/api/service/members/loginHistory").param("today", String.valueOf(today)) .with(csrf())//(1..

[Error] - HttpClient 라이브러리 버전 문제(NoClassDefFoundError: org/apache/hc/client5/http/classic/HttpClient)

[문제 상황] Caused by: java.lang.NoClassDefFoundError: org/apache/hc/client5/http/classic/HttpClient [해결 과정] - 해당 오류가 났을 때 구글링을 해봤는데 httpcore관련 라이브러리를 추가해주면 된다 했지만 추가해도 계속 오류가 났다. - 그래서 해당 오류가 난 부분에 어떤 내용이 있나 살펴보았더니 위에 써있는대로 스프링 6버전 이상은 다른 httpclient를 사용해야 한다고 떠있다. [오류 해결 방법] org.apache.httpcomponents httpclient 4.5.13 ↓ org.apache.httpcomponents.client5 httpclient5 5.2.1 - 본인은 spring 6.0.4 버전을 사용하고..

[Error] - Caused by: org.springframework.security.config.annotation.AlreadyBuiltException: This object has already been built

[문제 상황] Caused by: org.springframework.security.config.annotation.AlreadyBuiltException: This object has already been built - 평소처럼 security 관련 설정 작업을 진행하던 도중 마주한 이 에러.. - 나는 최신 버전의 스프링 시큐리티를 사용하고 있어서 stackoverflow에서 제공하는 build() 를 지우라는 답변이 적용되지 않는 케이스였다. - 그래서 이것저것 해보다 찾아낸 해답 ㅎ [문제 발생 코드] package com.yaloostore.shop.config; import com.yalooStore.security_utils.filter.JwtAuthenticationFilter; imp..

[controller test error] - Caused by: java.lang.IllegalStateException: Ambiguous handler methods mapped for

[에러 발생] jakarta.servlet.ServletException: Request processing failed: java.lang.IllegalStateException: Ambiguous handler methods mapped for '/api/service/members/check/test': {public co m.yalooStore.common_utils.dto.ResponseDto co m.yaloostore.shop.member.controller.QueryMemberRestController.existMemberBy(java.lang.String), public co m.yalooStore.common_utils.dto.ResponseDto co m.yaloostore.shop...

[stack][백준] - 2812. 크게 만들기(python)

# stack이 있나 확인하고 해당 값이 다음 값보다 크면 넣고 작으면 뺴고 n, k = map(int,input().split()) li = list(input()) stack = [] for i in li: while stack and stack[-1] 0: stack.pop() k -= 1 stack.append(i) if k > 0: print(''.join(stack[:-k])) else: print(''.join(stack)) [문제 해설] 1924를 예시로 생각해보자 해당 K를 충족하지 못한다면 해당 개수만큼 stack에서 뺀 숫자를 돌려주면 된다. 까다롭지 않은 조건이라 어렵지 않은 stack 문제이다.

[알고리즘][DP] - unique path

[문제] https://leetcode.com/problems/unique-paths/ Unique Paths - LeetCode Can you solve this real interview question? Unique Paths - There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot leetcode.com - 해당 문제는 조합을 이용해서 풀이가 가능하다. - 조합을 사용하게 되면 해당 문제에 변수를 주었..

문제풀이 2023.06.19