How do you handle external configuration properties in Spring Boot?
Spring Boot reads configuration from files, profiles, environment variables and command-line arguments. Learn precedence and typed binding with records.
2,882 posts about Java: questions with answers, tutorials and articles, newest first.
Spring Boot reads configuration from files, profiles, environment variables and command-line arguments. Learn precedence and typed binding with records.
The application-{profile}.yml file holds settings that load only when a Spring profile is active, overriding application.yml for each environment.
Use @Profile, profile-specific property files and spring.profiles.active to run one Spring Boot build with different configuration in dev, test and production.
@ManagedResource turns a Spring bean into a JMX MBean so tools like JConsole can read attributes and call operations. It needs @EnableMBeanExport or Boot JMX.
Expose Spring beans as JMX MBeans with @ManagedResource and manage them from JConsole or VisualVM. Covers Boot settings and secure remote access.
CacheManager is Spring's registry of named caches. It connects cache annotations to a provider such as Caffeine or Redis without changing business code.
A practical guide to Spring's @Cacheable: key expressions, condition and unless, sync, multiple managers and the proxy pitfalls that disable caching.
@EnableAsync turns on Spring's @Async support so annotated methods run on a task executor. Learn return types, executor setup, virtual threads and exception handling.
Configure ThreadPoolTaskExecutor and the Spring Boot task properties correctly, understand how queue size controls growth, and choose rejection policies.
The @Async annotation runs a Spring bean method on a separate executor thread so the caller does not wait. See setup, return types, executors and pitfalls.
Add @EnableScheduling and annotate a method with @Scheduled(cron). This guide covers Spring's six-field syntax, time zones, intervals, externalised config and running jobs on several replicas.
TaskScheduler is Spring's abstraction for scheduling one-off and recurring tasks. See its methods, ThreadPoolTaskScheduler setup, cron triggers and common pitfalls.
@Scheduled lets a Spring bean method run repeatedly at fixed rates, delays or cron times. Learn how to enable it, write cron expressions and know its limits.
Build a WebSocket handler with TextWebSocketHandler or STOMP @MessageMapping in Spring 6+, including registration, session safety, origins and handshake checks.
WebSocketStompClient is Spring's client for STOMP over WebSocket. Learn how to configure it, connect with connectAsync, and handle messages and heartbeats.
Use ReactorNettyWebSocketClient to connect to a WebSocket server, send messages and process incoming frames as a Flux, with backoff-based reconnection.
Learn how the reactive WebSocketHandler interface processes WebSocket sessions in Spring WebFlux, with echo, broadcast, error handling and security tips.
Learn how to add reactive WebSocket endpoints to Spring WebFlux with WebSocketHandler, URL mapping, broadcasting through a sink, and a WebSocketClient.
CorsConfiguration is Spring's holder for CORS rules such as allowed origins, methods and credentials. Learn to apply it in MVC, Spring Security and WebFlux.
Configure CORS in a reactive Spring app with @CrossOrigin, a global CorsRegistry or CorsWebFilter, and enable it in Spring Security for preflight requests.