스프링 오류 질문드립니다.
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
서비스에서와 컨트롤러의 @Vaild 적용 차이에 대해서
0
48
2
copilot-instruction.md
0
37
2
"폴더를 찾을 수 없습니다." 라는 응답만 계속 나옵니다.
0
46
1
EmailSender 관련 문의
0
55
1
조회 메서드 네이밍 질문
0
67
1
Properties 설정이 추가되었는데
0
38
1
isInterrupted 질문 있다.
0
37
1
fieldInjectionTest() 질문
0
58
1
AutoAppConfig의 존재이유
0
52
1
RunIdIncrementer batch 5랑 6랑
1
66
2
AppConfig와 스프링 빈 질문
0
57
1
강의 자료를 받아볼 순 없겠나
1
81
2
핵사고날 아키텍처 기반으로 멀티 모듈 설계 시 질문드립니다..
0
76
2
자료 다운로드 문제
0
76
2
인넬리제이 무료버전
0
68
2
DataSourceUtils.releaseConnection 할때요 SQLException e 사용하는 이유등
0
90
2
수업자료 오타
0
80
2
Post, PostEntity에서 User, UserEntity 의존
0
63
1
이클립스 스프링 환경설정 오류
0
94
2
내부 객체 직접 접근에 관하여.
0
106
2
CertificationServiceTest
0
60
1
FlushModeType.COMMIT (12:45) 예시코드 질문
0
68
1
클로드코드 명령어 - 대화&세션관리부분 강의자료 빈폴더
0
78
1
Spock given and가 검증을 하는지
0
65
1





