You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/migration/servlet/config.adoc
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -873,6 +873,50 @@ open class SecurityConfiguration {
873
873
----
874
874
====
875
875
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
+
876
920
==== Other Scenarios
877
921
878
922
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