[JAVA] Spring Boot + PostgreSQL error resolution method

I'm currently studying Spring, so I decided to write down the stumbling points as a memorandum here.

Study materials

Thorough introduction to Spring Java application development with Spring Framework

Stumbled part: Chapter 14

Target page: p632-659 After running the app, the following error occurred on the console.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource 
Invocation of init method failed; nested exception is javax.persistence.PersistenceException: 
[PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is 
org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [meeting_room]

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate 
SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-
validation: missing table [meeting_room]

Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: 
Schema-validation: missing table [meeting_room]


I was able to resolve the error by adding the description of the following two files.



In the previous version, if schema.sql and data.sql were placed directly under src / main / resources, it seems to be executed when the application starts. In the new version, the default of spring.datasource.initialization-mode is embedded, and it is set to be executed only by H2. Therefore, you can set anything to OK by setting it to always.



Create it in the same location as the application.properties file and write the following line.

Recommended Posts

Spring Boot + PostgreSQL error resolution method
Spring boot controller method memo
How to set Spring Boot + PostgreSQL
Use DynamoDB query method in Spring Boot
RSpec error resolution undefined method `feature'for RSpec: Module
Spring Boot + Thymeleaf BootStrap installation method memo
Javaw.exe error when starting Spring Boot (STS)
ITMS-90626 Error Resolution
Challenge Spring Boot
Spring Boot Form
Spring Boot Memorandum
gae + spring boot
Until data acquisition with Spring Boot + MyBatis + PostgreSQL
About No Method Error
SPRING BOOT learning record 01
Spring Boot + Heroku Postgres
Spring boot memo writing (1)
First Spring Boot (DI)
SPRING BOOT learning record 02
Spring Boot2 cheat sheet
Spring Boot exception handling
Spring Boot Servlet mapping
Spring boot development-development environment-
Spring Boot learning procedure
ActionController :: InvalidAuthenticityToken error resolution
Customize REST API error response with Spring Boot (Part 2)
[Ruby] Invalid multibyte char (UTF-8) Error resolution method [CSV]
rails error resolution summary
Extend Spring Boot DefaultErrorViewResolver to dynamically customize error screens
Learning Spring Boot [Beginning]
Spring boot memo writing (2)
Spring Boot 2.2 Document Summary
[Spring Boot] DataSourceProperties $ DataSourceBeanCreationException
Spring Boot 2.3 Application Availability
Spring boot tutorials Topics
Customize REST API error response with Spring Boot (Part 1)
Download with Spring Boot
Error resolution on Heroku
[Ruby on Rails] undefined method ╩╗id'for nil: NilClass error resolution method
Minimal customization of Spring Boot error page (implementation of ErrorController interface)
Get error information using DefaultErrorAttributes and ErrorAttributeOptions in Spring Boot 2.3
[Spring Boot] Environment construction (macOS)
Set context-param in Spring Boot
Spring + MyBatis connection setting method
Try Spring Boot from 0 to 100.
Generate barcode with Spring Boot
Spring validation and error code
Hello World with Spring Boot
Spring Boot on Microsoft Azure
Implement GraphQL with Spring Boot
About Spring Framework context error
Spring Boot tutorial task schedule
java setter getter error resolution
Spring 5 & Spring Boot 2 Hands-on preparation procedure
Get started with Spring boot
Hello World with Spring Boot!
Spring Boot 2 multi-project in Gradle
[Spring Boot] Web application creation
spring boot port duplication problem
Run LIFF with Spring Boot
SNS login with Spring Boot