- Spring Boot ORM Tutorial
- Spring Boot ORM - Home
- Spring Boot ORM - Overview
- Environment Setup
- Spring Boot ORM & Spring Data JPA
- Spring Boot ORM - Create Project
- Application.properties
- Spring Boot ORM - Update Project
- Spring Boot ORM - Test Hibernate
- Spring Boot ORM & EclipseLink
- Maven EclipseLink
- Update Project EclipseLink
- Spring Boot ORM - Test EclipseLink
- Spring Boot ORM Useful Resources
- Spring Boot ORM - Quick Guide
- Spring Boot ORM - Useful Resources
- Spring Boot ORM - Discussion
Spring Boot ORM - Application.properties
Spring boot reads application as well as persistence related properties from application.properties. Here we can configure the hibernate or any other ORM framework specific properties as well. We're using generic properties so that we can switch between ORM without changing much code. By default, spring boot configure hibernate as ORM provider if no other ORM library is specified in POM.xml.
Create application.properties under src −> main −> resources directory and update as shown below.
application.properties
#datasource configurations spring.datasource.url=jdbc:mysql://localhost:3306/tutorialspoint?useSSL=false&allowPublicKeyRetrieval=true spring.datasource.username=root spring.datasource.password=root@123 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # show SQL spring.jpa.show-sql: true # DDL generation spring.jpa.generate-ddl=true
Following is the description of key attributes of application.properties.
spring.datasource − Database specific attributes like connection url, username, password, driver class etc.
spring.jpa − jpa specific attributes like to show sql, to allow create tables etc.