How do you configure data sources in Spring Boot?
Set up a Spring Boot DataSource with application properties, tune HikariCP, configure multiple databases and test with Testcontainers.
2,882 posts about Java: questions with answers, tutorials and articles, newest first.
Set up a Spring Boot DataSource with application properties, tune HikariCP, configure multiple databases and test with Testcontainers.
@Rollback decides whether a Spring test-managed transaction is rolled back or committed after the test method. Rollback is the default, which keeps tests isolated.
Spring rolls back on unchecked exceptions by default. Learn rollbackFor, noRollbackFor, programmatic rollback and common reasons rollbacks fail.
The Propagation enum decides whether a @Transactional method joins, suspends or starts a transaction. Learn all seven types and when to pick each.
Spring transaction propagation controls how a @Transactional method behaves when a transaction already exists. See all seven types with examples and pitfalls.
Use @Transactional in Spring Boot to commit and roll back reliably, with propagation, isolation, rollback rules, TransactionTemplate and the proxy pitfalls to avoid.
@Transactional turns transaction handling into configuration in Spring. See propagation, isolation, rollback rules and why it sometimes does nothing.
Define an event record, publish it with ApplicationEventPublisher and handle it with @EventListener. Covers async and transaction-bound listeners.
A runnable Spring Boot walk-through: define an event, publish it from a service, handle it with listeners and pick synchronous, async or after-commit delivery.
@EventListener lets Spring beans react to application events with plain methods, decoupling publishers from consumers in event-driven designs.
Build a custom PropertySource, register it with an EnvironmentPostProcessor and know when spring.config.import or @PropertySource is enough.
The Spring Environment abstraction unifies property resolution and profile management, letting one codebase read config and switch behaviour per environment.
Learn how to bind typed, validated custom configuration in Spring Boot 3 with @ConfigurationProperties, profiles, @Value and conditional beans.
It registers @ConfigurationProperties classes as beans and binds external properties to them. This guide shows records, validation and the Boot alternatives.
Use @ConfigurationProperties to map application.yml and environment variables onto type-safe beans. Covers records, validation, @Value and overrides.
@ConfigurationProperties maps a property prefix to a typed, validated Java object with relaxed binding. Compare it with @Value and see Spring Boot 3 record examples.
Bind application.yml settings to typed, validated Java records with @ConfigurationProperties, and learn registration, precedence and testing in Spring Boot 3.
@Value injects externalized configuration into Spring beans using placeholders and SpEL. Learn defaults, pitfalls and the @ConfigurationProperties alternative.
Learn the three ways to read application.properties in Spring Boot 3: @Value, @ConfigurationProperties and Environment, and when to use each.
PropertySourcesPlaceholderConfigurer resolves placeholders from the Spring Environment and properties files. See Java and XML setup, key options, and what Spring Boot does for you.