Events, Scheduling, Async, and Observability
Cert Focus
You should understand how Spring handles in-process events, scheduled work, async execution, and production diagnostics.
Must Know
ApplicationEventPublisherpublishes events inside the Spring application context.@EventListenerhandles events.- Spring events are synchronous by default.
@TransactionalEventListenercan run listeners around transaction phases such asAFTER_COMMIT.@Scheduledruns methods based on time.@EnableSchedulingenables scheduled methods.fixedRatemeans start-to-start.fixedDelaymeans finish-to-next-start.@Asyncruns methods in another thread.@EnableAsyncenables async method execution.@Asyncis proxy-based, so self-invocation can bypass it.- Actuator exposes production diagnostics such as health, info, metrics, mappings, beans, conditions, and scheduled tasks.
- Expose and secure Actuator endpoints carefully.
Direct Book Links
- Spring Events
- Scheduling and Async
- Final Lesson — Actuator, Observability, Production Diagnostics, and Spring Professional Final Review
- Spring Boot Actuator
Exam Traps
Events are not a message broker. They are in-process and not durable.
@Scheduled is not a distributed job platform. Every app instance may run the same job unless you design around it.
@Async does not automatically share transaction, request, or security context.
Self-Check
- Can I explain synchronous Spring events?
- Can I explain
AFTER_COMMIT? - Can I explain
fixedRatevsfixedDelay? - Can I explain why every app instance may run the same scheduled job?
- Can I name Actuator endpoints that should be secured?
Model Answers
Spring events are synchronous by default, so the publisher waits while listeners run unless async execution is configured.
AFTER_COMMIT means a transactional event listener runs only after the surrounding transaction commits successfully.
fixedRate is start-to-start timing. fixedDelay is finish-to-next-start timing.
Every app instance may run the same scheduled job because @Scheduled is local to each running application instance. Multi-instance deployments need locking, idempotency, or an external scheduler.
Actuator endpoints such as env, beans, configprops, mappings, conditions, loggers, and sometimes metrics should be carefully secured or not exposed publicly.
Memory Sentence
Events say something happened; scheduling is about time; async is about threads; Actuator makes production visible.