What is the purpose of the @EnableWebSecurity annotation?

What is the purpose of the @EnableWebSecurity annotation?

A) To enable Spring Security’s web security support
B) To configure database access
C) To enable Spring Boot’s auto-configuration
D) To create REST APIs

Answer:

A) To enable Spring Security’s web security support

Explanation:

The @EnableWebSecurity annotation is used to enable Spring Security’s web security support in a Spring application. This annotation is typically added to a configuration class that extends WebSecurityConfigurerAdapter, allowing you to customize the security configuration, such as specifying which endpoints require authentication, configuring user roles, and setting up login mechanisms.

By using @EnableWebSecurity, you activate Spring Security’s capabilities, ensuring that your application is protected by the security configurations defined in the application.

Reference links:

https://www.javaguides.net/p/spring-security-tutorial.html

Leave a Comment

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

Scroll to Top