浏览代码

Improve deprecation notice in WebSecurityConfigurerAdapter

Closes gh-12260
Marcus Da Coregio 2 年之前
父节点
当前提交
f561d3784e

+ 18 - 1
config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java

@@ -91,7 +91,24 @@ import org.springframework.web.accept.HeaderContentNegotiationStrategy;
  * @see EnableWebSecurity
  * @deprecated Use a {@link org.springframework.security.web.SecurityFilterChain} Bean to
  * configure {@link HttpSecurity} or a {@link WebSecurityCustomizer} Bean to configure
- * {@link WebSecurity}
+ * {@link WebSecurity}. <pre>
+ *     &#64;Bean
+ *     public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
+ *         http
+ *             .authorizeHttpRequests((authz) ->
+ *                 authz.anyRequest().authenticated()
+ *             );
+ *             // ...
+ *         return http.build();
+ *     }
+ *
+ *    &#64;Bean
+ *    public WebSecurityCustomizer webSecurityCustomizer(WebSecurity web) {
+ *        return (web) -> web.ignoring().antMatchers("/resources/**");
+ *    }
+ * </pre> See the <a href=
+ * "https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter">Spring
+ * Security without WebSecurityConfigurerAdapter</a> for more details.
  */
 @Order(100)
 @Deprecated