diff --git a/src/main/java/bootcamp/wssrs/domain/Member/repository/DBInit.java b/src/main/java/bootcamp/wssrs/domain/Member/repository/DBInit.java index 647a03d..e2b0281 100644 --- a/src/main/java/bootcamp/wssrs/domain/Member/repository/DBInit.java +++ b/src/main/java/bootcamp/wssrs/domain/Member/repository/DBInit.java @@ -1,29 +1,29 @@ -//package bootcamp.wssrs.domain.Member.repository; -// -//import bootcamp.wssrs.domain.Member.entity.Member; -//import jakarta.annotation.PostConstruct; -//import lombok.RequiredArgsConstructor; -//import org.springframework.beans.factory.annotation.Value; -//import org.springframework.security.crypto.password.PasswordEncoder; -//import org.springframework.stereotype.Component; -// -//@Component -//@RequiredArgsConstructor -//public class DBInit { -// -// private final AuthRepository authRepository; -// private final PasswordEncoder encoder; -// -// @Value("${admin.email}") -// private String email; -// -// @Value("${admin.password}") -// private String password; -// -// -// @PostConstruct -// private void postConstruct() { -// Member admin = Member.createAdmin(email, password, encoder); -// authRepository.save(admin); -// } -//} \ No newline at end of file +package bootcamp.wssrs.domain.Member.repository; + +import bootcamp.wssrs.domain.Member.entity.Member; +import jakarta.annotation.PostConstruct; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class DBInit { + + private final AuthRepository authRepository; + private final PasswordEncoder encoder; + + @Value("${admin.email}") + private String email; + + @Value("${admin.password}") + private String password; + + + @PostConstruct + private void postConstruct() { + Member admin = Member.createAdmin(email, password, encoder); + authRepository.save(admin); + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3be8184..cdd7170 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -15,7 +15,7 @@ spring: jpa: database: postgresql hibernate: - ddl-auto: update + ddl-auto: create properties: hibernate: format_sql: true