Spring-boot populate H2 database with schema.sql and data.sql

后端 未结 1 494
难免孤独
难免孤独 2021-02-05 16:42

I set up Spring-boot to work with H2 in-memory database application.properties file is in the /config directory and it looks like, this file is process

1条回答
  •  孤街浪徒
    2021-02-05 17:03

    Resolved the issue.

    The spring boot app requires its ownd jdbc dependency

    
      org.springframework.boot
      spring-boot-starter-jdbc
    
    

    NON-boot dependency, that I had, is NOT enough alone:

    
      org.springframework
      spring-jdbc
    
    

    Without the "spring-boot-starter-jdbc" dependency "spring.datasource.url" settings in file "application.properties" are not processed. That file is actually processed, but not the jdbc settings. Spring boot will create its own testdb in the memory, which destroys the data after closing the application.

    0 讨论(0)
提交回复
热议问题