How can you customize the access-denied behavior in Spring Security for methods secured with annotations?
- Access-denied behavior is not customizable in Spring Security.
- By implementing a custom AccessDeniedHandler and registering it with Spring Security.
- By modifying the application.yml file.
- By using the @AccessDeniedHandler annotation on methods that need custom access-denied handling.
To customize access-denied behavior, you should implement a custom AccessDeniedHandler, which allows you to define how to handle access-denied situations. You then register this handler with Spring Security to apply it to secured methods.
Loading...
Related Quiz
- For configuring a DataSource programmatically in Spring Boot, you can create a @Bean of type _____.
- The error messages of validation constraints in Spring Boot can be externalized using the _____ property in the constraint annotation.
- How can you perform integration testing on security configurations in a Spring Boot application to ensure security constraints are met?
- How does enabling lazy initialization affect the startup time of a Spring Boot application?
- How would you optimize the performance of a Spring Boot application that frequently interacts with a database?