|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright 2002-2022 the original author or authors.
|
|
|
+ * Copyright 2002-2023 the original author or authors.
|
|
|
*
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
+import static org.assertj.core.api.Assertions.assertThatNoException;
|
|
|
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication;
|
|
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
|
@@ -56,6 +57,12 @@ public class EnableWebSecurityTests {
|
|
|
this.spring.getContext().getBean("springSecurityFilterChain", DebugFilter.class);
|
|
|
}
|
|
|
|
|
|
+ // gh-14370
|
|
|
+ @Test
|
|
|
+ public void loadConfigWhenEnableWebMvcDebugConfigThenContextIsBuilt() {
|
|
|
+ assertThatNoException().isThrownBy(() -> this.spring.register(EnableWebMvcDebugConfig.class).autowire());
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void configureWhenEnableWebMvcThenAuthenticationPrincipalResolvable() throws Exception {
|
|
|
this.spring.register(AuthenticationPrincipalConfig.class).autowire();
|
|
@@ -86,6 +93,13 @@ public class EnableWebSecurityTests {
|
|
|
assertThat(parentBean.getChild()).isNotSameAs(childBean);
|
|
|
}
|
|
|
|
|
|
+ @Configuration
|
|
|
+ @EnableWebMvc
|
|
|
+ @EnableWebSecurity(debug = true)
|
|
|
+ static class EnableWebMvcDebugConfig {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Configuration
|
|
|
static class ChildSecurityConfig extends DebugSecurityConfig {
|
|
|
|