해결된 질문
작성
·
243
·
수정됨
1
1장 프로젝트 환경설정 부분 듣고 있습니다!
test는 실행되는데 ,Test 실행 후 localhost에 접속해서 h2-console에 들어가야되는데, 바로 spring boot가 꺼져버려서 강의 진도를 못나가고 있어요 ㅠㅠ 강의pdf 꼼꼼히 읽어보고 yml, build.gradle도 고쳤는데 안됩니다. 뭐가 잘못된 걸까요? ㅠㅠ
아래는 log 끝 부분 입니당,, DB에 값이 들어갔다가 오류 메시지가 뜨네요
insert into member (username,id) values (?,?)
insert into member (username,id) values ('memberA',1);
2023-12-21T21:29:43.402+09:00 INFO 25432 --- [ Test worker] p6spy : #1703161783402 | took 1ms | commit | connection 4| url jdbc:h2:tcp://localhost/~/jpashop
;
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2023-12-21T21:29:43.464+09:00 INFO 25432 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2023-12-21T21:29:43.469+09:00 INFO 25432 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2023-12-21T21:29:43.492+09:00 INFO 25432 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
아래는 application.yml입니다
spring:
datasource:
url: jdbc:h2:tcp://localhost/~/jpashop;
username: sa
password:
driver-class-name: org.h2.Driver
jpa:
hibernate:
ddl-auto: create
properties:
hibernate:
# show_sql: true
format_sql: true
dialect: org.hibernate.dialect.H2Dialect
logging.level:
org.hibernate.SQL: debug
# org.hibernate.orm.jdbc.bind: trace #스프링 부트 3.x, hibernate6
아래는 build.gradle 입니다
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.6'
id 'io.spring.dependency-management' version '1.1.4'
}
group = 'jpabook'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-devtools'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation("org.junit.vintage:junit-vintage-engine"){
exclude group: "org.hamcrest", module: "hamcrest-core"
}
}
tasks.named('test') {
useJUnitPlatform()
}
답변 1
0
localhost:8080/h2-console로 안들어가도 된다는 말씀이신가요?
test 실행 후 아래처럼 들어가니 not found라고 뜹니다