인프런 커뮤니티 질문&답변

ijeee님의 프로필 이미지
ijeee

작성한 질문수

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

JPA와 DB 설정, 동작확인

Member 테이블이 생성되지 않습니다..

해결된 질문

작성

·

305

0

Member 테이블이 생성되지 않습니다..

21:59:04.275 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class jpabook.jpashop.MemberRepositoryTest]

21:59:04.279 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]

21:59:04.288 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]

21:59:04.307 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [jpabook.jpashop.MemberRepositoryTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]

21:59:04.324 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [jpabook.jpashop.MemberRepositoryTest], using SpringBootContextLoader

21:59:04.328 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [jpabook.jpashop.MemberRepositoryTest]: class path resource [jpabook/jpashop/MemberRepositoryTest-context.xml] does not exist

21:59:04.328 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [jpabook.jpashop.MemberRepositoryTest]: class path resource [jpabook/jpashop/MemberRepositoryTestContext.groovy] does not exist

21:59:04.328 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [jpabook.jpashop.MemberRepositoryTest]: no resource found for suffixes {-context.xml, Context.groovy}.

21:59:04.329 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [jpabook.jpashop.MemberRepositoryTest]: MemberRepositoryTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.

21:59:04.379 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.471 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [E:\공부\JPA\jpa_활용_1\project\jpashop\out\production\classes\jpabook\jpashop\JpashopApplication.class]

21:59:04.477 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration jpabook.jpashop.JpashopApplication for test class jpabook.jpashop.MemberRepositoryTest

21:59:04.641 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [jpabook.jpashop.MemberRepositoryTest]: using defaults.

21:59:04.642 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]

21:59:04.657 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@35a3d49f, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@389b0789, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@13d9cbf5, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@478db956, org.springframework.test.context.support.DirtiesContextTestExecutionListener@6ca18a14, org.springframework.test.context.transaction.TransactionalTestExecutionListener@c667f46, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@51bd8b5c, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@7b50df34, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@1b410b60, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@2462cb01, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@19b843ba, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@64ec96c6]

21:59:04.659 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.660 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.668 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.668 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.669 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.670 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.670 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.670 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.674 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@463fd068 testClass = MemberRepositoryTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@895e367 testClass = MemberRepositoryTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@34e9fd99, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@6a6cb05c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@22ff4249, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@662ac478], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].

21:59:04.675 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.675 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [jpabook.jpashop.MemberRepositoryTest]

21:59:04.697 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::       (v2.1.17.RELEASE)

2020-10-15 21:59:05.202  INFO 30540 --- [           main] jpabook.jpashop.MemberRepositoryTest     : Starting MemberRepositoryTest on DESKTOP-J3IVAOF with PID 30540 (started by jeng8 in E:\공부\JPA\jpa_활용_1\project\jpashop)

2020-10-15 21:59:05.208  INFO 30540 --- [           main] jpabook.jpashop.MemberRepositoryTest     : No active profile set, falling back to default profiles: default

2020-10-15 21:59:06.431  INFO 30540 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.

2020-10-15 21:59:06.454  INFO 30540 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14ms. Found 0 JPA repository interfaces.

2020-10-15 21:59:07.165  INFO 30540 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...

2020-10-15 21:59:07.365  INFO 30540 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.

2020-10-15 21:59:07.482  INFO 30540 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [

name: default

...]

2020-10-15 21:59:07.584  INFO 30540 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.18.Final}

2020-10-15 21:59:07.586  INFO 30540 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found

2020-10-15 21:59:07.764  INFO 30540 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}

2020-10-15 21:59:08.366  INFO 30540 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

2020-10-15 21:59:08.961 DEBUG 30540 --- [           main] org.hibernate.SQL                        : 

    

    drop table member if exists

2020-10-15 21:59:08.963 DEBUG 30540 --- [           main] org.hibernate.SQL                        : 

    

    drop sequence if exists hibernate_sequence

2020-10-15 21:59:08.965 DEBUG 30540 --- [           main] org.hibernate.SQL                        : create sequence hibernate_sequence start with 1 increment by 1

2020-10-15 21:59:08.967 DEBUG 30540 --- [           main] org.hibernate.SQL                        : 

    

    create table member (

       id bigint not null,

        username varchar(255),

        primary key (id)

    )

2020-10-15 21:59:08.974  INFO 30540 --- [           main] o.h.t.schema.internal.SchemaCreatorImpl  : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@4b9f7edc'

2020-10-15 21:59:08.976  INFO 30540 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'

2020-10-15 21:59:09.643  INFO 30540 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'

2020-10-15 21:59:09.698  WARN 30540 --- [           main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

2020-10-15 21:59:09.744  INFO 30540 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page: class path resource [static/index.html]

2020-10-15 21:59:10.111  INFO 30540 --- [           main] jpabook.jpashop.MemberRepositoryTest     : Started MemberRepositoryTest in 5.403 seconds (JVM running for 6.585)

2020-10-15 21:59:10.212  INFO 30540 --- [           main] o.s.t.c.transaction.TransactionContext   : Began transaction (1) for test context [DefaultTestContext@463fd068 testClass = MemberRepositoryTest, testInstance = jpabook.jpashop.MemberRepositoryTest@6d5de79a, testMethod = testMemeber@MemberRepositoryTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@895e367 testClass = MemberRepositoryTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@34e9fd99, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@6a6cb05c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@22ff4249, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@662ac478], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@749ee0e3]; rollback [false]

2020-10-15 21:59:10.294 DEBUG 30540 --- [           main] org.hibernate.SQL                        : 

    call next value for hibernate_sequence

2020-10-15 21:59:10.367 DEBUG 30540 --- [           main] org.hibernate.SQL                        : 

    insert 

    into

        member

        (username, id) 

    values

        (?, ?)

2020-10-15 21:59:10.375  INFO 30540 --- [           main] o.s.t.c.transaction.TransactionContext   : Committed transaction for test: [DefaultTestContext@463fd068 testClass = MemberRepositoryTest, testInstance = jpabook.jpashop.MemberRepositoryTest@6d5de79a, testMethod = testMemeber@MemberRepositoryTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@895e367 testClass = MemberRepositoryTest, locations = '{}', classes = '{class jpabook.jpashop.JpashopApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@34e9fd99, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@6a6cb05c, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@22ff4249, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@662ac478], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true]]

2020-10-15 21:59:10.383  INFO 30540 --- [       Thread-1] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

2020-10-15 21:59:10.383  INFO 30540 --- [       Thread-1] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

2020-10-15 21:59:10.386  INFO 30540 --- [       Thread-1] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...

2020-10-15 21:59:10.395  INFO 30540 --- [       Thread-1] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

Process finished with exit code 0

답변 4

0

김영한님의 프로필 이미지
김영한
지식공유자

ㅎㅎ 잘 해결하셨습니다^^

0

김영한님의 프로필 이미지
김영한
지식공유자

Je-Hyun Lee님 application.yml의 위치를 다시 확인해보시겠어요?

src/main/resources 하위에 있어야 합니다.

0

ijeee님의 프로필 이미지
ijeee
질문자

자문 자답입니다.

datasorce 라고 썼었네요...ㅎㅎㅎ

datasource 로 고치니 정상 동작합니다 :)

0

ijeee님의 프로필 이미지
ijeee
질문자

p6spy까지 추가하고 log를 보니까

2020-10-15 22:53:33.087  INFO 27012 --- [           main] p6spy                                    : #1602770013087 | took 6ms | statement | connection 4| url jdbc:h2:mem:testdb

memory모드로 testdb로 붙었다고 나오네요..;

application.yml 파일은 아래와 같습니다.

spring:
  datasorce:
    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

logging:
  level:
    org.hibernate.SQL: debug
    org.hibernate.type: trace
ijeee님의 프로필 이미지
ijeee

작성한 질문수

질문하기