How do you implement caching with Spring Boot?
A complete Spring Boot caching example with Caffeine: setup, a cached service and controller, expiry, eviction, a test and troubleshooting tips.
2,882 posts about Java: questions with answers, tutorials and articles, newest first.
A complete Spring Boot caching example with Caffeine: setup, a cached service and controller, expiry, eviction, a test and troubleshooting tips.
@EnableAspectJAutoProxy registers the auto-proxy creator that makes @Aspect advice run on Spring beans. See how proxies, proxyTargetClass and self-invocation work.
Use Spring AOP aspects, filters, interceptors and controller advice to keep logging, auditing and error handling out of business code.
Learn the Spring mechanisms for conditional beans: profiles, property flags, back-off defaults and custom Condition classes, plus how to test them.
@ConditionalOnProperty registers Spring Boot beans only when a property matches. Learn its attributes, feature toggles, defaults and how to test it.
Implement HealthIndicator in Spring Boot Actuator to monitor your own dependencies, with custom statuses, reactive support and Kubernetes probe groups.
HealthIndicator is the Spring Boot Actuator contract for a single health check. Implement it to report the state of your own dependencies.
Set up Spring Boot Admin Server and clients to monitor health, add custom HealthIndicator beans, secure the setup and send status change notifications.
Spring Boot Admin gives one dashboard over the Actuator endpoints of many Spring Boot apps. See setup, features and production advice.
Build custom Actuator endpoints with @Endpoint and the operation annotations, expose them over HTTP or JMX, test them and restrict access.
There is no @EnableActuator annotation in Spring Boot. Actuator is enabled by the starter dependency and configured with management properties.
Create custom Counter, Timer and Gauge metrics with Micrometer and export them to Prometheus from a Spring Boot 3 application.
Micrometer is the vendor-neutral metrics library Spring Boot uses via Actuator. See how to configure it, export to Prometheus and record custom meters.
Add Spring Boot Actuator and a Micrometer registry, expose the metrics endpoints, and create custom counters, timers and gauges for Prometheus.
@Scheduled(fixedRate) runs a Spring method at a steady interval measured from each run's start. See how it differs from fixedDelay and what happens when a run is slow.
Performance test a Spring Boot app with Actuator metrics, Testcontainers, and a Gatling or k6 load scenario with latency thresholds.
The @Import annotation adds only the configuration classes a test needs, making Spring tests faster and more focused. See practical examples.
A practical guide to test properties in Spring Boot: profile files, inline overrides, dynamic Testcontainers values and fast configuration binding tests.
@SpringBootConfiguration marks the primary configuration class of a Spring Boot app and is what tests search for. Learn how it differs from @Configuration.
Use @WebMvcTest and MockMvc to test controllers in isolation, with services replaced by @MockitoBean mocks. Includes validation, security and error tests.