본문 바로가기

개발/SpringBoot13

[springboot] test case @Aftereach 어노테이션 test case 작성 시 이전에 저장 된 값 때문에 오류가 생길 때가 있습니다. test case 는 순서에 의존되지 않아야 하기 때문에 순서와 상관없이 test 가 성공해야 하는데 이럴 때 사용하는 @Aftereach 에 대해서 알아보겠습니다! 이건 몰랐던 내용인데 이번에 강의 들으면서 알게되어 정리하게 됐습니다 ㅎㅎ ✔ 개념 @Aftereach 어노테이션이 명시된 메서드는 테스트 메서드 하나 실행 후 반드시 실행됩니다. test case는 독립적으로 수행되어야 합니다. ✔사용방법 아래의 Test case 들은 하나씩 실행하면 모두 성공하지만, Class 레벨에서 한번에 실행하면 오류가 생깁니다. 이유는 findAll 메서드가 먼저 실행되어 값이 먼저 저장되면서 findByName 메서드가 실패하게 .. 2022. 12. 18.
[SpringBoot] 스프링부트 jar 파일 터미널에서 명령어로 빌드하기 서버 배포할 때 spring 동작 시키는 방법 jar 넣고 실행시키기 cd hello-spring hello-spring % ls -al hello-spring % ./gradlew build hello-spring % cd build build % ls -al build % cd libs libs % ls -arlth libs % java -jar hello-spring-0.0.1-SNAPSHOT.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | /.. 2022. 12. 18.
[오류] No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.0 was found. ✔ 문제 springboot 3.0 빌드 오류 > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.0 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value.... ✔ 해결과정 sprinbgoot version 3.0 -> 2.7.6 으로 변경 ✔ 원인 spring boot 3.0 .. 2022. 12. 18.
[오류/해결] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. ✔ 환경 인텔리제이 MacOS Java 11 ✔ 문제 Spring boot 프로젝트를 생성 할 때 Dependency 에 사용할 데이터베이스를 미리 정해놓고 생성하는 경우가 많다. 이럴 때 어플리케이션을 실행하면 다음과 같은 문제가 발생한다. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please pu.. 2022. 8. 7.