In Spring Security, how can you implement method-level security annotations?

  • Use the @MethodSecurity annotation to secure methods.
  • Apply @PreAuthorize and @PostAuthorize annotations.
  • Use @EnableMethodSecurity with @Configuration class.
  • Define method-level security in the application.properties file.
Method-level security annotations in Spring Security are implemented by using @EnableMethodSecurity in a @Configuration class and applying @PreAuthorize and @PostAuthorize annotations on methods. Options 1 and 4 are incorrect, while Option 2 is partially correct but not the recommended approach.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *