본문 바로가기

코딩/예외 창고

(7)
intellij 콘솔에서 한글이 깨질 때 1. setting - build, execution, deployment에서 gradle 들어가서 gradle -> intellij로 바꾸기 2. 인코딩 바꾸기. 모두 utf-8로 바꾸면 된다. 뭐 jvm 옵션 바꾸고 하지마라. 이것만 하면 된다. 프로젝트를 만들 때 마다 해줘야한다.
[spring boot] org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers!2 matchers expected, 1 recorded: 단위 테스트 도중 아래와 같은 예외 발생. org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers! 2 matchers expected, 1 recorded: 핵심을 실제 값을 넣으면 안되고 matcher를 사용해서 넣어야한다. @Test public void findByStoreTest() { //given Store s = Store.builder() .uuid(UUID.randomUUID()) .build(); Cake c = Cake.builder() .uuid(UUID.randomUUID()) .store(s) .build(); Customer customer1 = Customer..
springboot 로컬에서는 테스트 통과하는데 aws linux에서는 통과못함.. # 로컬에서는 모든 테스트를 통과하는데 aws에서만 유난히 계속 실패했다... 얻은 교훈 : 역시 코딩할 때는 하나부터 열까지 다 의심하고 이게 맞을까?라고 생각할 시간에 검증해보는게 빠르다.. # 이유를 찾고자 하나씩 수정하면서 commit을 날렸다. 혼자 작업하는 거라서 커밋 어떻게 날리든 상관없었음.. Test클래스에 @Commit도 붙이고 괜히 @modifying도 붙여보았다. 근데 이들은 문제가 아니었다. 마지막 커밋에서 나와있듯이 Store->store로 바꿔서 해결할 수 있었다. 왜인지 알아보자. # 먼저 위의 사진을 보면 StoreRepositoryTest의 findByLocation()에서 예외 발생이다. 오류 스크린샷을 보면 StoreRepositoryTest:112에서 발생한다고 나와..
ModelMapper 를 사용할 때는 @NoArgConstructor있어야 한다.! 그렇다.. 다른 글에서 말했지만 reflection기반의 ModelMapper사용하지말고 어노테이션 기반의 MapStruct를 사용하자.
spring scurity 예외: 페이지가 작동하지 않습니다. localhost에서 리디렉션한 횟수가 너무 많습니다. 아래는 브라우저 모습 아래 캡쳐에서 개발자도구에서 login으로 계속 리다이렉션을 보내는 것을 확인. status code 302는 redirection임. 아래는 토이프로젝트의 config java파일 코드임. 아래의 configure()함수에서 빌더패턴을 사용해 설정하는데 설정 순서가 중요했다.!! package pnu.problemsolver.myorder.config; import io.jsonwebtoken.Jwt; import lombok.RequiredArgsConstructor; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.s..
SpringBoot DI, @Configuration 에서 주의할 점. Error creating bean with name 'jwtAuthenticationFilter': Requested bean is currently in creation: Is there an unresolvable circular reference? package pnu.problemsolver.myorder.config; import io.jsonwebtoken.Jwt; import lombok.RequiredArgsConstructor; import org.springframework.context.ApplicationContext; 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.conf..
Spring, JUnit5 @BeforeAll @BeforeAll의 함수는 static이어야한다. 아래와 같이 @TestInstance(TestInstacne.Lifecycle.PER_CLASS)를 붙이지 않으면 static~ 예외 발생한다.