Reduce need for bean method proxying and disable where not needed
Closes gh-9068
This commit is contained in:
@@ -1902,7 +1902,7 @@ annotation, as shown in the following example:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableAutoConfiguration
|
||||
@EntityScan(basePackageClasses=City.class)
|
||||
public class Application {
|
||||
@@ -2082,14 +2082,14 @@ as shown in the following example:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableJpaRepositories(basePackageClasses = Customer.class,
|
||||
entityManagerFactoryRef = "customerEntityManagerFactory")
|
||||
public class CustomerConfiguration {
|
||||
...
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableJpaRepositories(basePackageClasses = Order.class,
|
||||
entityManagerFactoryRef = "orderEntityManagerFactory")
|
||||
public class OrderConfiguration {
|
||||
@@ -2600,7 +2600,7 @@ requests, consider adding your own `WebSecurityConfigurerAdapter` that adds the
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SslWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -394,7 +394,7 @@ A typical Spring Security configuration might look something like the following
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class ActuatorSecurity extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
@@ -430,7 +430,7 @@ following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class ActuatorSecurity extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -428,7 +428,7 @@ features like middleware declarations, as shown in the following example:
|
||||
|
||||
[source,groovy,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class Application implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -992,7 +992,7 @@ You also need to list the properties classes to register in the
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(AcmeProperties.class)
|
||||
public class MyConfiguration {
|
||||
}
|
||||
@@ -1532,7 +1532,7 @@ example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Profile("production")
|
||||
public class ProductionConfiguration {
|
||||
|
||||
@@ -2221,7 +2221,7 @@ If you need to add or customize converters, you can use Spring Boot's
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.http.converter.*;
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -2713,7 +2713,7 @@ defined by registering a `WebMvcConfigurer` bean with a customized
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -2771,7 +2771,7 @@ actual handling of the requests, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class RoutingConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -2854,7 +2854,7 @@ component, as shown in the following example:
|
||||
----
|
||||
import org.springframework.boot.web.codec.CodecCustomizer;
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -4871,7 +4871,7 @@ follows:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SomeConfiguration {
|
||||
|
||||
@Bean(BeanNames.COUCHBASE_CUSTOM_CONVERSIONS)
|
||||
@@ -5276,7 +5276,7 @@ Then you can define a `@Configuration` class to configure the extra `Bucket` and
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CouchbaseCacheConfiguration {
|
||||
|
||||
private final Cluster cluster;
|
||||
@@ -5626,7 +5626,7 @@ For instance, the following example exposes another factory that uses a specific
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class JmsConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -5790,7 +5790,7 @@ specific `MessageConverter`:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class RabbitConfiguration {
|
||||
|
||||
@Bean
|
||||
@@ -7867,7 +7867,7 @@ at the same level as your application, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableBatchProcessing
|
||||
public class BatchConfiguration { ... }
|
||||
----
|
||||
@@ -8232,13 +8232,13 @@ condition, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
// Some conditions
|
||||
public class MyAutoConfiguration {
|
||||
|
||||
// Auto-configured beans
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(EmbeddedAcmeService.class)
|
||||
static class EmbeddedConfiguration {
|
||||
|
||||
@@ -8273,7 +8273,7 @@ method, as shown in the following example:
|
||||
|
||||
[source,java,indent=0]
|
||||
----
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class MyAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -472,7 +472,7 @@ as shown in the following example:
|
||||
import org.springframework.boot.autoconfigure.jdbc.*;
|
||||
import org.springframework.context.annotation.*;
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
|
||||
public class MyConfiguration {
|
||||
}
|
||||
@@ -599,7 +599,7 @@ scan in your application:
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableAutoConfiguration
|
||||
@Import({ MyConfig.class, MyAnotherConfig.class })
|
||||
public class Application {
|
||||
|
||||
@@ -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.context.annotation.Configuration;
|
||||
*/
|
||||
public class MetricsFilterBeanExample {
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class MetricsFilterExampleConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
|
||||
@@ -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.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(UserService.class)
|
||||
@EnableConfigurationProperties(UserProperties.class)
|
||||
public class UserServiceAutoConfiguration {
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
*
|
||||
* @author Johnny Lim
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CloudFoundryCustomContextPathExample {
|
||||
|
||||
// tag::configuration[]
|
||||
|
||||
@@ -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.
|
||||
@@ -33,7 +33,7 @@ public class TomcatLegacyCookieProcessorExample {
|
||||
/**
|
||||
* Configuration class that declares the required {@link WebServerFactoryCustomizer}.
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class LegacyCookieProcessorConfiguration {
|
||||
|
||||
// tag::customizer[]
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ public class HibernateSearchElasticsearchExample {
|
||||
* {@link EntityManagerFactoryDependsOnPostProcessor} that ensures that
|
||||
* {@link EntityManagerFactory} beans depend on the {@code elasticsearchClient} bean.
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class ElasticsearchJpaDependencyConfiguration
|
||||
extends EntityManagerFactoryDependsOnPostProcessor {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -33,7 +33,7 @@ public class BasicDataSourceExample {
|
||||
/**
|
||||
* A configuration that exposes an empty {@link DataSource}.
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class BasicDataSourceConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
@@ -37,7 +37,7 @@ public class ConfigurableDataSourceExample {
|
||||
* A configuration that defines dedicated settings and reuses
|
||||
* {@link DataSourceProperties}.
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class ConfigurableDataSourceConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
|
||||
@@ -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.
|
||||
@@ -35,7 +35,7 @@ public class SimpleDataSourceExample {
|
||||
/**
|
||||
* A simple configuration that exposes dedicated settings.
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class SimpleDataSourceConfiguration {
|
||||
|
||||
// tag::configuration[]
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
// tag::configuration[]
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HibernateSecondLevelCacheExample {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -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.
|
||||
@@ -35,7 +35,7 @@ import org.springframework.kafka.support.serializer.JsonSerde;
|
||||
public class KafkaStreamsBeanExample {
|
||||
|
||||
// tag::configuration[]
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableKafkaStreams
|
||||
static class KafkaStreamsExampleConfiguration {
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CustomWebFluxSecurityExample {
|
||||
|
||||
// @formatter:off
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ public class UnauthenticatedAccessExample {
|
||||
* {@link WebSecurity} argument to customize access rules.
|
||||
*/
|
||||
// tag::configuration[]
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -63,12 +63,12 @@ public class UserServiceAutoConfigurationTests {
|
||||
this.contextRunner.withUserConfiguration(UserConfiguration.class)
|
||||
.run((context) -> {
|
||||
assertThat(context).hasSingleBean(UserService.class);
|
||||
assertThat(context.getBean(UserService.class)).isSameAs(
|
||||
context.getBean(UserConfiguration.class).myUserService());
|
||||
assertThat(context).getBean("myUserService")
|
||||
.isSameAs(context.getBean(UserService.class));
|
||||
});
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class UserConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -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.
|
||||
@@ -48,7 +48,7 @@ public class TomcatLegacyCookieProcessorExampleTests {
|
||||
.isInstanceOf(LegacyCookieProcessor.class);
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -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.
|
||||
@@ -84,7 +84,7 @@ public class AppSystemPropertiesTests {
|
||||
};
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(AppSystemProperties.class)
|
||||
static class Config {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user