2V0-72.22PSE · Question #58
@EnableGlobalMethodSecurity is annotation used in Spring Security to secure which layer?
The correct answer is C. Service layer. @EnableGlobalMethodSecurity secures the service layer because it enables method-level security annotations (@PreAuthorize, @PostAuthorize, @Secured) that are applied directly to service beans - enforcing authorization at the business logic level regardless of how that logic is…
Question
@EnableGlobalMethodSecurity is annotation used in Spring Security to secure which layer?
Options
- AWeb layer
- BController layer
- CService layer
- DDAO layer
How the community answered
(51 responses)- A2% (1)
- B2% (1)
- C88% (45)
- D8% (4)
Explanation
@EnableGlobalMethodSecurity secures the service layer because it enables method-level security annotations (@PreAuthorize, @PostAuthorize, @Secured) that are applied directly to service beans - enforcing authorization at the business logic level regardless of how that logic is invoked. Options A and B (Web and Controller layers) are wrong because those layers are secured by Spring Security's HTTP security configuration (e.g., HttpSecurity, antMatchers), not method-level annotations. Option D (DAO layer) is incorrect because security concerns belong above the data access layer; applying security at the DAO level would be too late and would bypass business rule enforcement. Memory tip: Think "Global Method = business Methods in your Service" - the annotation's name literally says "method security," and services are where your business methods live.
Topics
Community Discussion
No community discussion yet for this question.