Skip to content

Commit 8c79920

Browse files
committed
Fix Spring Security configuration in tests
As of spring-projects/spring-security#11653, Spring Security's [at]Enable*Security annotations are not meta annotated with [at]Configuration which breaks some of our tests. This commit adds missing [at]Configuration annotations where needed. Closes spring-projectsgh-2118
1 parent 812ac23 commit 8c79920

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/integration/MongoDbDeleteJacksonSessionVerificationTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -137,6 +137,7 @@ ResponseEntity<String> hello() {
137137

138138
}
139139

140+
@Configuration(proxyBeanMethods = false)
140141
@EnableWebFluxSecurity
141142
static class SecurityConfig {
142143

spring-session-data-mongodb/src/integration-test/java/org/springframework/session/data/mongo/integration/MongoDbLogoutVerificationTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -135,6 +135,7 @@ ResponseEntity<String> hello() {
135135

136136
}
137137

138+
@Configuration(proxyBeanMethods = false)
138139
@EnableWebFluxSecurity
139140
static class SecurityConfig {
140141

spring-session-docs/modules/ROOT/examples/java/docs/security/RememberMeSecurityConfiguration.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
1919
import java.util.concurrent.ConcurrentHashMap;
2020

2121
import org.springframework.context.annotation.Bean;
22+
import org.springframework.context.annotation.Configuration;
2223
import org.springframework.security.config.Customizer;
2324
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
2425
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -32,6 +33,7 @@
3233
/**
3334
* @author rwinch
3435
*/
36+
@Configuration(proxyBeanMethods = false)
3537
@EnableWebSecurity
3638
@EnableSpringHttpSession
3739
public class RememberMeSecurityConfiguration extends WebSecurityConfigurerAdapter {

spring-session-samples/spring-session-sample-javaconfig-hazelcast/src/main/java/sample/SecurityConfig.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,13 +17,15 @@
1717
package sample;
1818

1919
import org.springframework.beans.factory.annotation.Autowired;
20+
import org.springframework.context.annotation.Configuration;
2021
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
2122
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
2223
import org.springframework.security.core.userdetails.User;
2324

2425
/**
2526
* @author Rob Winch
2627
*/
28+
@Configuration(proxyBeanMethods = false)
2729
@EnableWebSecurity
2830
public class SecurityConfig {
2931

spring-session-samples/spring-session-sample-javaconfig-rest/src/main/java/sample/SecurityConfig.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717
package sample;
1818

1919
import org.springframework.beans.factory.annotation.Autowired;
20+
import org.springframework.context.annotation.Configuration;
2021
import org.springframework.security.config.Customizer;
2122
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
2223
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -25,6 +26,7 @@
2526
import org.springframework.security.core.userdetails.User;
2627
import org.springframework.security.web.savedrequest.NullRequestCache;
2728

29+
@Configuration(proxyBeanMethods = false)
2830
@EnableWebSecurity
2931
public class SecurityConfig extends WebSecurityConfigurerAdapter {
3032

spring-session-samples/spring-session-sample-javaconfig-security/src/main/java/sample/SecurityConfig.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,13 +17,15 @@
1717
package sample;
1818

1919
import org.springframework.beans.factory.annotation.Autowired;
20+
import org.springframework.context.annotation.Configuration;
2021
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
2122
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
2223
import org.springframework.security.core.userdetails.User;
2324

2425
/**
2526
* @author Rob Winch
2627
*/
28+
@Configuration(proxyBeanMethods = false)
2729
@EnableWebSecurity
2830
public class SecurityConfig {
2931

0 commit comments

Comments
 (0)