@EnableWebSecurity is used for spring security java configuration.
Add this annotation with @configuration on top of your security java class that extends WebSecurityConfigurerAdapter .
Override the configure(WebSecurity web) & configure(HttpSecurity http) .