🍃 Spring Boot

Database Integration

14 lessons in this section of the Spring Boot tutorial. Work through them in order, or jump to the one you need.

  1. 1.MySQL Integration

    Connect Spring Boot 3 to MySQL the production-ready way: Connector/J, SSL mode, UTC time zones, HikariCP pool sizing, Flyway migrations (with MySQL's non-transactional…

  2. 2.PostgreSQL Integration

    Connect Spring Boot 3 to PostgreSQL and handle the parts that usually break: JSONB and array columns, native enums, upserts, and full-text search with an index that is…

  3. 3.MongoDB Integration

    Connect a Spring Boot 3 application to MongoDB with Spring Data MongoDB: connection setup, document mapping, repositories, MongoTemplate queries, aggregations, indexes…

  4. 4.Oracle DB Integration

    Connect a Spring Boot 3 application to Oracle Database with Spring Data JPA and Hibernate 6: driver setup, connection URLs, Flyway migrations, sequence-based IDs…

  5. 5.SQL Server Integration

    Connecting Spring Boot to SQL Server is mostly painless once you know the handful of places it differs from Postgres or MySQL: the driver encrypts by default, IDENTITY…

  6. 6.Spring Boot H2 Database: In-Memory Setup, Console, Testing and Testcontainers

    Set up H2 in Spring Boot: in-memory and file modes, H2 console, schema.sql and data.sql, compatibility modes, @DataJpaTest, and when to use Testcontainers.

  7. 7.Redis Integration

    Spring Boot auto-configures Redis through spring-boot-starter-data-redis, providing RedisTemplate for low-level operations, Spring Cache abstraction for…

  8. 8.Cassandra Integration

    Spring Boot integrates with Apache Cassandra through spring-boot-starter-data-cassandra, providing CassandraTemplate for low-level operations and Spring Data…

  9. 9.Elasticsearch Integration

    Spring Boot integrates with Elasticsearch through spring-boot-starter-data-elasticsearch, providing ElasticsearchTemplate for low-level operations and Spring Data…

  10. 10.Flyway Migration

    Flyway is a database migration tool that versions schema changes as SQL or Java migration scripts.

  11. 11.Spring Boot Liquibase Tutorial: Changelogs, Changesets, Rollback, Contexts and Testing

    Learn Liquibase with Spring Boot: setup, YAML and SQL changesets, preconditions, contexts, rollback, checksum errors, and Testcontainers tests with examples.

  12. 12.Multiple Databases

    Spring Boot supports connecting to multiple databases in a single application by defining separate DataSource, EntityManagerFactory, and TransactionManager beans for…

  13. 13.Connection Pooling

    Connection pooling maintains a reusable set of pre-established database connections, eliminating the overhead of creating and tearing down a TCP connection and…

  14. 14.HikariCP

    HikariCP is the default JDBC connection pool in Spring Boot, and it is fast mostly because it does very little: a small, well-tuned core and a short list of settings.