나를 기록하다
article thumbnail
[Spring Boot] @Test(expected ~) 에러 (Junit4, Junit5)
Error/Spring Boot 2023. 7. 13. 15:59

에러 내용 1) 발생 package jpabook.jpashop.service; import jpabook.jpashop.domain.Member; import jpabook.jpashop.repository.MemberRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.junit.jupiter.api.Test; import org.springframework.test.annotation.Rollback; import org.springframework.transaction.annotation.T..

article thumbnail
[Spring Boot] gradlew: BUILD FAILED
Error/Spring Boot 2023. 7. 12. 11:35

에러 내용 1) 발생 2) 원인 원인은 간단했다. 강의를 보며 따라할 때, h2 DB를 끄고 하는건줄 알고 iterm에서 ctrl + C를 눌러 h2 DB를 끄고 ./gradlew clean build를 실행했었다. 하지만 백그라운드로 h2 DB를 실행시켜둔 상태로 build를 진행해야 한다. 3) 해결 제대로 build가 된 것을 볼 수 있다. clean build를 성공한 후 java -jar을 통해 .jar 파일을 터미널에서 실행시킬 수 있다.

article thumbnail
[Spring Boot]쿼리 파라미터 로그 남기기, SQL 한줄 출력 해결
Error/Spring Boot 2023. 7. 12. 10:55

에러 내용 1) 발생 2) 원인 구글링을 통해 여러 사람들이 말한 방법들을 다 해봤다. 우선 나는 스프링부트 2.7.~ 을 사용 중이다. 우선 쿼리파라미터는 아래의 라이브러리와 로깅 구문을 통해 해결할 수 있다. 스프링부트 2.x 외부 라이브러리 추가 implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.6' application.yml에 logging 구문 추가 logging: level: org.hibernate.SQL: debug org.hibernate.type: trace 스프링부트 3.0 이상을 사용할 경우 외부 라이브러리 추가 implementation 'com.github.gavlyukovskiy:p6spy-sprin..

article thumbnail
[Spring Boot] initializationError 해결(@RunWith 관련)
Error/Spring Boot 2023. 7. 11. 21:42

@RunWith(SpringRunner.class) 매핑 시 initializationError 발생 1) 발생 package jpabook.jpashop; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.spring..

article thumbnail
[Spring Boot] assertThat 호출 오류 해결
Error/Spring Boot 2023. 7. 11. 21:38

1. assertThat 호출 오류(import 구문 문제) 1) 발생 위와 같이 Assertions을 임포트하였으나 assertThat에 빨간줄이 그이는 것을 확인할 수 있다. 2) 원인 이유를 찾기 위해 서핑 결과, Intellij에서 자동으로 import 해주는 구문의 문제라는 것을 알 수 있었다. 3) 해결 [intelliJ] assertThat import 안되는 오류 [intelliJ] assertThat import 안되는 오류 문제 발생 assertThat을 사용하기 위해 AssertJ를 import를 하려고 했는데 import가 안되는 문제가 발생했다. 해결 방법 import static org.junit.Assert.*; 테스트를 생성할 때 자동으로 들어가는 import문을 지워주 sh..

profile on loading

Loading...