Spring PostgreSQL Support: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 20: Line 20:
=<span id='Configuration'></span>Spring Configuration=
=<span id='Configuration'></span>Spring Configuration=


<syntaxhighlight lang=''>
<syntaxhighlight lang='text'>
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=something
spring.datasource.username=something

Revision as of 05:29, 19 October 2018

External

Internal

Overview

Dependencies

dependencies {

    implementation('org.springframework.boot:spring-boot-starter-data-jpa')
    runtimeOnly('org.postgresql:postgresql')
}

Spring Configuration

spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=something
spring.datasource.password=somethingelse

If using Spring Boot Database Initialization and Postgres-specific DDL and DML, create schema-postgres.sql, data-postgres.sql files and configure the "plaform" as:

spring.datasource.platform=postgres

More details available here:

Spring Boot Database Initialization