Reduce need for bean method proxying and disable where not needed

Closes gh-9068
This commit is contained in:
Andy Wilkinson
2019-02-08 14:51:38 +00:00
parent 0f71f22f3c
commit 68bfb020aa
887 changed files with 2574 additions and 2542 deletions

View File

@@ -53,7 +53,7 @@ import org.springframework.util.ObjectUtils;
* @since 1.4.0
* @see AutoConfigureTestDatabase
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore(DataSourceAutoConfiguration.class)
public class TestDatabaseAutoConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -56,7 +56,7 @@ import org.springframework.util.ReflectionUtils;
* @see AutoConfigureJsonTesters
* @since 1.4.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(name = "org.assertj.core.api.Assert")
@ConditionalOnProperty("spring.test.jsontesters.enabled")
@AutoConfigureAfter({ JacksonAutoConfiguration.class, GsonAutoConfiguration.class,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -32,7 +32,7 @@ import org.springframework.context.annotation.Configuration;
* @since 1.4.0
* @see AutoConfigureTestEntityManager
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ EntityManagerFactory.class })
@AutoConfigureAfter(HibernateJpaAutoConfiguration.class)
public class TestEntityManagerAutoConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -45,11 +45,11 @@ import org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation
* @author Roman Zaynetdinov
* @since 1.4.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication
public class RestDocsAutoConfiguration {
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(MockMvcRestDocumentation.class)
@ConditionalOnWebApplication(type = Type.SERVLET)
@EnableConfigurationProperties(RestDocsProperties.class)
@@ -79,7 +79,7 @@ public class RestDocsAutoConfiguration {
}
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ RequestSpecification.class,
RestAssuredRestDocumentation.class })
@EnableConfigurationProperties(RestDocsProperties.class)
@@ -106,7 +106,7 @@ public class RestDocsAutoConfiguration {
}
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(WebTestClientRestDocumentation.class)
@ConditionalOnWebApplication(type = Type.REACTIVE)
@EnableConfigurationProperties(RestDocsProperties.class)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -41,7 +41,7 @@ import org.springframework.web.client.RestTemplate;
* @since 1.4.0
* @see AutoConfigureMockRestServiceServer
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.test.webclient.mockrestserviceserver", name = "enabled")
public class MockRestServiceServerAutoConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -32,7 +32,7 @@ import org.springframework.web.client.RestTemplate;
* @since 1.4.0
* @see AutoConfigureMockRestServiceServer
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.test.webclient", name = "register-rest-template")
@AutoConfigureAfter(RestTemplateAutoConfiguration.class)
public class WebClientRestTemplateAutoConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -45,7 +45,7 @@ import org.springframework.web.server.WebHandler;
* @author Andy Wilkinson
* @since 2.0.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ WebClient.class, WebTestClient.class })
@AutoConfigureAfter({ CodecsAutoConfiguration.class, WebFluxAutoConfiguration.class })
@Import(WebTestClientSecurityConfiguration.class)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -28,7 +28,7 @@ import org.springframework.test.web.reactive.server.MockServerConfigurer;
*
* @author Madhura Bhave
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(SecurityMockServerConfigurers.class)
class WebTestClientSecurityConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -47,7 +47,7 @@ import org.springframework.web.servlet.DispatcherServlet;
* @see AutoConfigureWebMvc
* @since 1.4.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication(type = Type.SERVLET)
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
@EnableConfigurationProperties({ ServerProperties.class, WebMvcProperties.class })

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -33,7 +33,7 @@ import org.springframework.web.context.WebApplicationContext;
*
* @author Andy Wilkinson
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(SecurityMockMvcRequestPostProcessors.class)
class MockMvcSecurityConfiguration {

View File

@@ -36,7 +36,7 @@ import org.springframework.test.web.servlet.htmlunit.MockMvcWebClientBuilder;
* @author Phillip Webb
* @since 1.4.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(WebClient.class)
@AutoConfigureAfter(MockMvcAutoConfiguration.class)
@ConditionalOnProperty(prefix = "spring.test.mockmvc.webclient", name = "enabled", matchIfMissing = true)

View File

@@ -42,7 +42,7 @@ import org.springframework.util.ClassUtils;
* @author Phillip Webb
* @since 1.4.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(HtmlUnitDriver.class)
@AutoConfigureAfter(MockMvcAutoConfiguration.class)
@ConditionalOnProperty(prefix = "spring.test.mockmvc.webdriver", name = "enabled", matchIfMissing = true)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -56,7 +56,7 @@ public class SpringBootDependencyInjectionTestExecutionListenerPostConstructInte
assertThat(this.calls).hasSize(1);
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class Config {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -87,7 +87,7 @@ public class SpringBootDependencyInjectionTestExecutionListenerTests {
.isEqualTo(originalFailure);
}
@Configuration
@Configuration(proxyBeanMethods = false)
@ImportAutoConfiguration(JacksonAutoConfiguration.class)
static class Config {

View File

@@ -150,7 +150,7 @@ public class ImportsContextCustomizerFactoryWithAutoConfigurationTests {
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EntityScan(basePackageClasses = ExampleEntity.class)
@AutoConfigurationPackage
static class EmptyConfig {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -49,7 +49,7 @@ public class AutoConfigureCacheIntegrationTests {
assertThat(bean).isInstanceOf(NoOpCacheManager.class);
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableCaching
public static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -50,7 +50,7 @@ public class AutoConfigureCacheWithExistingCacheManagerIntegrationTests {
assertThat(bean).isInstanceOf(ConcurrentMapCacheManager.class);
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableCaching
public static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -54,7 +54,7 @@ public class AutoConfigureTestDatabaseWithMultipleDatasourcesIntegrationTests {
assertThat(product).startsWith("H2");
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration
static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -50,7 +50,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplaceAutoConfiguredIntegrati
assertThat(product).startsWith("HSQL");
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration // Will auto-configure H2
static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -54,7 +54,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplaceExplicitIntegrationTest
assertThat(product).startsWith("HSQL");
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration
static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -56,7 +56,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplacePropertyAnyIntegrationT
assertThat(product).startsWith("HSQL");
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration
static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -52,7 +52,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplacePropertyAutoConfiguredI
assertThat(product).startsWith("HSQL");
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration // Will auto-configure H2
static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -68,7 +68,7 @@ public class TestDatabaseAutoConfigurationTests {
});
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class ExistingDataSourceConfiguration {
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -71,7 +71,7 @@ public class TestDatabaseAutoConfigurationNoEmbeddedTests {
});
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class ExistingDataSourceConfiguration {
@Bean

View File

@@ -124,7 +124,7 @@ public class PropertyMappingContextCustomizerFactoryTests {
}
@Configuration
@Configuration(proxyBeanMethods = false)
@TypeMappingAnnotation
static class ConfigMapping {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2019 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.
@@ -59,7 +59,7 @@ public class AutoConfigureWebClientWithRestTemplateIntegrationTests {
assertThat(entity.getBody()).isEqualTo("hello");
}
@Configuration
@Configuration(proxyBeanMethods = false)
@EnableAutoConfiguration
static class Config {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -120,7 +120,7 @@ public class WebTestClientAutoConfigurationTests {
});
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class BaseConfiguration {
@Bean
@@ -130,7 +130,7 @@ public class WebTestClientAutoConfigurationTests {
}
@Configuration
@Configuration(proxyBeanMethods = false)
@Import(BaseConfiguration.class)
static class CodecConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -69,7 +69,7 @@ public class WebTestClientSpringBootTestIntegrationTests {
.hasSize(1);
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class TestConfiguration {
@Bean

View File

@@ -66,7 +66,7 @@ public class SpringBootMockMvcBuilderCustomizerTests {
assertThat(filters).containsExactlyInAnyOrder(testFilter, otherTestFilter);
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class ServletConfiguration {
@Bean
@@ -76,7 +76,7 @@ public class SpringBootMockMvcBuilderCustomizerTests {
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class FilterConfiguration {
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -62,7 +62,7 @@ public class WebMvcTestWebDriverCustomScopeIntegrationTests {
assertThat(previousWebDriver).isNotNull().isSameAs(this.webDriver);
}
@Configuration
@Configuration(proxyBeanMethods = false)
static class Config {
@Bean