Skip to content

Commit a0540f5

Browse files
Deprecate AbstractConfiguredSecurityBuilder#apply
Closes gh-13436
1 parent 1ff5eb6 commit a0540f5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

config/src/main/java/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ public O getOrBuild() {
118118
* @param configurer
119119
* @return the {@link SecurityConfigurerAdapter} for further customizations
120120
* @throws Exception
121+
* @deprecated For removal in 7.0. Use
122+
* {@link #with(SecurityConfigurerAdapter, Customizer)} instead.
121123
*/
124+
@Deprecated(since = "6.2", forRemoval = true)
122125
@SuppressWarnings("unchecked")
123126
public <C extends SecurityConfigurerAdapter<O, B>> C apply(C configurer) throws Exception {
124127
configurer.addObjectPostProcessor(this.objectPostProcessor);

docs/modules/ROOT/pages/migration-7/configuration.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,10 @@ The Lambda DSL was created to accomplish to following goals:
116116
- Automatic indentation makes the configuration more readable.
117117
- The is no need to chain configuration options using `.and()`
118118
- The Spring Security DSL has a similar configuration style to other Spring DSLs such as Spring Integration and Spring Cloud Gateway.
119+
120+
== Use `.with()` instead of `.apply()` for Custom DSLs
121+
122+
In versions prior to 6.2, if you had a xref:servlet/configuration/java.adoc#jc-custom-dsls[custom DSL], you would apply it to the `HttpSecurity` using the `HttpSecurity#apply(...)` method.
123+
However, starting from version 6.2, this method is deprecated and will be removed in 7.0 because it will no longer be possible to chain configurations using `.and()` once `.and()` is removed (see https://github.com/spring-projects/spring-security/issues/13067).
124+
Instead, it is recommended to use the new `.with(...)` method.
125+
For more information about how to use `.with(...)` please refer to the xref:servlet/configuration/java.adoc#jc-custom-dsls[Custom DSLs section].

0 commit comments

Comments
 (0)