Skip to content
Ameen Abozaid
Planned lessonJNR-026-L01

DataSource configuration in Boot

  • Lesson 1 of 5
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

connect Shop to PostgreSQL with properties only.

Planned topics

  • Add the spring-boot-starter-jdbc dependency and the PostgreSQL driver.
  • Set spring.datasource.url, username, and password in application.yml; Boot builds a HikariCP pool.
  • Secrets come from environment variables, not from the file in Git.
  • Pool size is configurable (spring.datasource.hikari.maximum-pool-size); defaults are fine to start.
  • Boot creates JdbcTemplate and JdbcClient beans for you.
Draft outline details

Demonstration

yaml
spring:
  datasource:
    url: jdbc:postgresql://localhost:5432/shop
    username: ${DB_USER}
    password: ${DB_PASSWORD}

Check your understanding

Which pool does Boot use by default?

Show answer

HikariCP.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.