What is the use of @EnableWebSecurity in spring

前端 未结 3 1493
猫巷女王i
猫巷女王i 2021-02-01 01:51

As per spring docs

Add this annotation to an @Configuration class to have the Spring Security configuration defined in any WebSecurit

3条回答
  •  一向
    一向 (楼主)
    2021-02-01 02:34

    @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). This is the replacement of xml based configurations like and . This way you can limit requested urls coming from specific urls also enable form based log in.

提交回复
热议问题