스프링 오류 질문드립니다.
package jpabook.jpashop;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MemberRepositoryTest {
@Autowired MemberRepository memberRepository;
@Test
@Transactional
@Rollback(false)
public void testMember() {
Member member = new Member();
member.setUsername("memberA");
Long savedId = memberRepository.save(member);
Member findMember = memberRepository.find(savedId);
Assertions.assertThat(findMember.getId()).isEqualTo(member.getId());
Assertions.assertThat(findMember.getUsername()).isEqualTo(member.getUsername());
Assertions.assertThat(findMember).isEqualTo(member); //JPA 엔티티 동일성 보장
}
}
위의 코드를 실행했는데, 아래와 같은 오류가 나왔습니다. 해결책을 알려주시면 감사하겠습니다.
... 91 common frames omitted
============================
CONDITIONS EVALUATION REPORT
============================
Positive matches:
-----------------
None
Negative matches:
-----------------
None
Exclusions:
-----------
None
Unconditional classes:
----------------------
None
2024-04-17T00:07:39.846+09:00 WARN 5176 --- [ Test worker] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] to prepare test instance [jpabook.jpashop.MemberRepositoryTest@41a23470]
java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@48368a08 testClass = jpabook.jpashop.MemberRepositoryTest, locations = [], classes = [jpabook.jpashop.JpashopApplication], contextInitializerClasses = [], activeProfiles = [], propertySourceDescriptors = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@49cb9cb5, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@146587a2, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@16c63f5, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@6127a7e, org.springframework.boot.test.context.SpringBootTestAnnotation@8694b330], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
... 55 more
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Unable to determine Dialect without JDBC metadata (please set 'jakarta.persistence.jdbc.url' for common cases or 'hibernate.dialect' when a custom Dialect implementation must be provided)
> Task :test FAILED
MemberRepositoryTest > testMember FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:180
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1786
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:276
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:191
1 test completed, 1 failed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///C:/study/jpashop/build/reports/tests/test/index.html
* Try:
> Run with --scan to get full insights.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 6s
4 actionable tasks: 1 executed, 3 up-to-date
답변 1
HelloSpringApplication.java 클래스 실행 오류
0
6
1
8월 31일 챌린지 업로드 오류
0
11
1
build 시 에러 해결방법 공유(docker.desktop 업데이트 -> 의존성 버전 수정)
0
16
1
네이버 API | '검색 - 책' API 제공 중단
0
37
2
Part 2 듣기전 복습하던 중, 아키텍처에 관한 질문이 있습니다.
0
44
2
장치 의존성과 CSR
0
35
1
테스트는 인터페이스를 대상으로 만드는것에 대해 궁금한 점이 있습니다.
0
30
1
[영한님]Spring Boot 및 프로젝트 생성
0
52
2
JPA 엔티티로 만들었다고 기술종속이 아닌지에 대한 질문
0
54
3
강의 요청 문의
0
39
2
클로드코드 명령어-대화&세션관리 수업 자료
0
42
1
PlatformTransactionManager, ResourcelessTransactionManager 질문
1
66
2
자료 한번에 다운받기
0
33
1
스프링 빈 등록 방법 2가지 다 알아야하는 이유
0
59
1
mybatis 를 이용한 crud에서 insert에서 resultType='long" 이라고 하셨는데요,
0
27
1
설계 트레이드 오프 링크 접속 안됨
0
85
2
테스트 질문, 어떤것을 사용할것인것에 대해서
0
46
1
깃허브주소 궁금합니다.
0
36
2
mariaDB 설정
0
33
1
섹션4 퀴즈 오타있어요.
0
46
1
AWS 배포 성능테스트
0
75
2
퀴즈가 안열려요
0
75
2
7강 보고 있는데요.. 글자가 너무 작아요
0
43
1
트래잭션 전파 기본- 에 대한 개념 질문? 이렇게 생각해도 맞나요?
0
46
1





