안녕하세요 김영한님
ddl-auto : create 인데도
테이블이 생성되지 않아 질문드립니다
application.yml 정보입니다
spring: datasource: url: jdbc:h2:tcp://localhost/~/datajpa username: sa password: driver-class-name: org.h2.Driverjpa: hibernate: ddl-auto: create properties: hibernate:# show_sql: true format_sql: true logging.level: org.hibernate.SQL: debug # org.hibernate.type: trace
build.gradle 정보입니다
plugins { id 'org.springframework.boot' version '2.4.2' id 'java'}apply plugin: 'io.spring.dependency-management'group = 'study'version = '0.0.1-SNAPSHOT'sourceCompatibility = '11'configurations { compileOnly { extendsFrom annotationProcessor }}repositories { mavenCentral()}dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test'}test { useJUnitPlatform()}
member 클래스입니다
package study.datajpa.entity;import lombok.Getter;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.Id;@Entity@Getterpublic class Member { @Id @GeneratedValue private Long id; private String username; public Member() { } public Member(String username) { this.username = username; }}
다음은 테스트입니다
@SpringBootTest@Transactionalclass MemberJpaRepositoryTest { @Autowired MemberJpaRepository memberJpaRepository; @Test public void 생성테스트() throws Exception { //given Member member = new Member("memberA"); //when Member savedMember = memberJpaRepository.save(member); Member findMember = memberJpaRepository.find(member.getId()); //then assertThat(savedMember.getId()).isEqualTo(findMember.getId()); }}
강의 극초반인데
테이블 생성이 안되어서 진행이 안되고 있습니다
찾아봐도 몰라서 질문 남깁니다