Skip to content

Commit 88d50a5

Browse files
Add EnableWebSecurity migration steps to 5.8 guide
Closes gh-12334
1 parent 7aaa25b commit 88d50a5

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

docs/modules/ROOT/pages/migration/servlet/config.adoc

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,50 @@ open class SecurityConfiguration {
873873
----
874874
====
875875

876+
== Add `@Configuration` to `@Enable*` annotations
877+
878+
In 6.0, all Spring Security's `@Enable*` annotations had their `@Configuration` removed.
879+
While convenient, it was not consistent with the rest of the Spring projects and most notably Spring Framework's `@Enable*` annotations.
880+
Additionally, the introduction of support for `@Configuration(proxyBeanMethods=false)` in Spring Framework provides another reason to remove `@Configuration` meta-annotation from Spring Security's `@Enable*` annotations and allow users to opt into their preferred configuration mode.
881+
882+
The following annotations had their `@Configuration` removed:
883+
884+
- `@EnableGlobalAuthentication`
885+
- `@EnableGlobalMethodSecurity`
886+
- `@EnableMethodSecurity`
887+
- `@EnableReactiveMethodSecurity`
888+
- `@EnableWebSecurity`
889+
- `@EnableWebFluxSecurity`
890+
891+
For example, if you are using `@EnableWebSecurity`, you will need to change:
892+
893+
====
894+
.Java
895+
[source,java,role="primary"]
896+
----
897+
@EnableWebSecurity
898+
public class SecurityConfig {
899+
// ...
900+
}
901+
----
902+
====
903+
904+
to:
905+
906+
====
907+
.Java
908+
[source,java,role="primary"]
909+
----
910+
@Configuration
911+
@EnableWebSecurity
912+
public class SecurityConfig {
913+
// ...
914+
}
915+
----
916+
====
917+
918+
And the same applies to every other annotation listed above.
919+
876920
==== Other Scenarios
877921

878922
If you are using `AuthenticationManagerBuilder` for something more sophisticated, you can xref:servlet/authentication/architecture.adoc#servlet-authentication-authenticationmanager[publish your own `AuthenticationManager` `@Bean`] or wire an `AuthenticationManager` instance into the `HttpSecurity` DSL with {security-api-url}org/springframework/security/config/annotation/web/builders/HttpSecurity.html#authenticationManager(org.springframework.security.authentication.AuthenticationManager)[`HttpSecurity#authenticationManager`].

0 commit comments

Comments
 (0)