|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2019 the original author or authors. |
| 2 | + * Copyright 2002-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
32 | 32 | import org.springframework.core.io.buffer.DataBuffer;
|
33 | 33 | import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
34 | 34 | import org.springframework.http.MediaType;
|
| 35 | +import org.springframework.mock.web.MockServletContext; |
35 | 36 | import org.springframework.security.authentication.TestingAuthenticationToken;
|
36 | 37 | import org.springframework.security.config.test.SpringTestContext;
|
37 | 38 | import org.springframework.security.config.test.SpringTestContextExtension;
|
|
64 | 65 | import org.springframework.util.MultiValueMap;
|
65 | 66 | import org.springframework.web.bind.annotation.GetMapping;
|
66 | 67 | import org.springframework.web.bind.annotation.RestController;
|
| 68 | +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; |
67 | 69 | import org.springframework.web.reactive.config.DelegatingWebFluxConfiguration;
|
68 | 70 | import org.springframework.web.reactive.config.EnableWebFlux;
|
69 | 71 | import org.springframework.web.reactive.function.BodyInserters;
|
@@ -307,6 +309,17 @@ public void resolveAuthenticationPrincipalArgumentResolverFirstDoesNotCauseBeanC
|
307 | 309 | DelegatingWebFluxConfiguration.class).autowire();
|
308 | 310 | }
|
309 | 311 |
|
| 312 | + @Test |
| 313 | + // gh-10076 |
| 314 | + public void webFluxConfigurationSupportAndServerHttpSecurityConfigurationDoNotCauseCircularReference() { |
| 315 | + AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); |
| 316 | + context.setAllowCircularReferences(false); |
| 317 | + context.register(EnableWebFluxSecurityConfiguration.class, ReactiveAuthenticationTestConfiguration.class, |
| 318 | + DelegatingWebFluxConfiguration.class); |
| 319 | + context.setServletContext(new MockServletContext()); |
| 320 | + context.refresh(); |
| 321 | + } |
| 322 | + |
310 | 323 | @EnableWebFluxSecurity
|
311 | 324 | @Import(ReactiveAuthenticationTestConfiguration.class)
|
312 | 325 | static class Config {
|
|
0 commit comments