|
|
|
|
@ -20,6 +20,7 @@ import java.io.Serializable;
@@ -20,6 +20,7 @@ import java.io.Serializable;
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.function.Consumer; |
|
|
|
|
import java.util.function.Supplier; |
|
|
|
|
|
|
|
|
|
import org.aopalliance.intercept.MethodInterceptor; |
|
|
|
|
@ -64,6 +65,8 @@ import org.springframework.security.test.context.support.WithSecurityContextTest
@@ -64,6 +65,8 @@ import org.springframework.security.test.context.support.WithSecurityContextTest
|
|
|
|
|
import org.springframework.test.context.ContextConfiguration; |
|
|
|
|
import org.springframework.test.context.TestExecutionListeners; |
|
|
|
|
import org.springframework.test.context.junit.jupiter.SpringExtension; |
|
|
|
|
import org.springframework.web.context.ConfigurableWebApplicationContext; |
|
|
|
|
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; |
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
|
|
|
|
@ -433,6 +436,17 @@ public class PrePostMethodSecurityConfigurationTests {
@@ -433,6 +436,17 @@ public class PrePostMethodSecurityConfigurationTests {
|
|
|
|
|
assertThat(this.spring.getContext().containsBean("annotationSecurityAspect$0")).isFalse(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// gh-13572
|
|
|
|
|
@Test |
|
|
|
|
public void configureWhenBeanOverridingDisallowedThenWorks() { |
|
|
|
|
this.spring.register(MethodSecurityServiceConfig.class, BusinessServiceConfig.class) |
|
|
|
|
.postProcessor(disallowBeanOverriding()).autowire(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static Consumer<ConfigurableWebApplicationContext> disallowBeanOverriding() { |
|
|
|
|
return (context) -> ((AnnotationConfigWebApplicationContext) context).setAllowBeanDefinitionOverriding(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
@EnableCustomMethodSecurity |
|
|
|
|
static class CustomMethodSecurityServiceConfig { |
|
|
|
|
|