2V0-72.22PSE · Question #62
How can auditing be enabled for Spring Boot Actuator?
The correct answer is D. None of the above. D is correct because Spring Boot Actuator auditing is automatically enabled by auto-configuration when Spring Security is on the classpath - no explicit opt-in is required. Spring Boot's AuditAutoConfiguration kicks in and registers an InMemoryAuditEventRepository without any…
Question
How can auditing be enabled for Spring Boot Actuator?
Options
- AThe @EnableAuditing annotation
- BSetting the property actuator.audit.enabled=true
- CDeclaring a bean of type AuditEventRepository
- DNone of the above.
How the community answered
(22 responses)- A14% (3)
- B36% (8)
- C5% (1)
- D45% (10)
Explanation
D is correct because Spring Boot Actuator auditing is automatically enabled by auto-configuration when Spring Security is on the classpath - no explicit opt-in is required. Spring Boot's AuditAutoConfiguration kicks in and registers an InMemoryAuditEventRepository without any developer action, wiring up authentication success/failure events out of the box.
Why the distractors fail:
- A (
@EnableAuditing) belongs to Spring Data's JPA entity auditing (tracking@CreatedDate,@LastModifiedBy, etc.) - a completely separate feature with no connection to Actuator. - B (
actuator.audit.enabled=true) is fabricated; this property does not exist in Spring Boot's auto-configuration. - C is the trickiest: while
AuditEventRepositoryis the central interface for audit storage, you don't need to declare one yourself - Spring Boot auto-registers anInMemoryAuditEventRepositoryfor you. Declaring your own bean overrides the default (e.g., to persist to a database), but it's not required to enable auditing.
Memory tip: When you see "enable X in Spring Boot," think auto-configuration first. Spring Boot's philosophy is convention over configuration - if something works out of the box (like audit events with Spring Security present), the correct answer is often "do nothing," making "None of the above" a trap-busting choice on exams.
Topics
Community Discussion
No community discussion yet for this question.