Which Spring Security annotation is used to apply security constraints at the method level based on SpEL expressions?
- @PreFilter
- @PostFilter
- @PreAuthorize
- @PostAuthorize
The @PreAuthorize annotation is used to apply security constraints at the method level based on SpEL (Spring Expression Language) expressions. You can define complex conditions using SpEL to control method access. The other options are used for filtering, not method-level security.
Loading...
Related Quiz
- How can you handle exceptions thrown by a controller method in a Spring Boot application?
- Imagine you are maintaining a large Spring Boot application with extensive custom auto-configurations. How would you manage and optimize these auto-configurations to avoid issues with application startup and runtime performance?
- You are tasked with implementing API Gateway in a Spring Cloud microservices environment. What considerations and configurations would you take into account to ensure proper routing, filtering, and security?
- You are tasked with ensuring that all components of a microservice are working well together in a Spring Boot application. What testing strategies and tools would you employ to ensure the correctness of interactions among components?
- Imagine you are creating a configuration class in Spring Boot that should only be processed if a certain bean is present in the ApplicationContext. How would you accomplish this?