Ensure that @Bean methods are only declared on @Configuration classes

Closes gh-16190
pull/16240/head
Andy Wilkinson 6 years ago
parent 3fdf2818b3
commit 821ee0cf83

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -334,6 +334,7 @@ public class EndpointAutoConfigurationTests {
} }
@Configuration
static class DataSourceConfig { static class DataSourceConfig {
@Bean @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -198,6 +198,7 @@ public class EndpointWebMvcManagementContextConfigurationTests {
} }
@Configuration
static class EnvConfiguration { static class EnvConfiguration {
@Bean @Bean
@ -208,6 +209,7 @@ public class EndpointWebMvcManagementContextConfigurationTests {
} }
@Configuration
static class MetricsConfiguration { static class MetricsConfiguration {
@Bean @Bean
@ -217,6 +219,7 @@ public class EndpointWebMvcManagementContextConfigurationTests {
} }
@Configuration
static class LoggersConfiguration { static class LoggersConfiguration {
@Bean @Bean
@ -236,6 +239,7 @@ public class EndpointWebMvcManagementContextConfigurationTests {
} }
@Configuration
static class LogFileConfiguration { static class LogFileConfiguration {
@Bean @Bean
@ -245,6 +249,7 @@ public class EndpointWebMvcManagementContextConfigurationTests {
} }
@Configuration
static class AuditEventsConfiguration { static class AuditEventsConfiguration {
@Bean @Bean
@ -264,6 +269,7 @@ public class EndpointWebMvcManagementContextConfigurationTests {
} }
@Configuration
static class HeapdumpConfiguration { static class HeapdumpConfiguration {
@Bean @Bean
@ -273,6 +279,7 @@ public class EndpointWebMvcManagementContextConfigurationTests {
} }
@Configuration
static class ShutdownConfiguration { static class ShutdownConfiguration {
@Bean @Bean

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -627,6 +627,7 @@ public class HealthIndicatorAutoConfigurationTests {
} }
@Configuration
protected static class JestClientConfiguration { protected static class JestClientConfiguration {
@Bean @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
@ -33,6 +34,7 @@ import org.springframework.dao.annotation.PersistenceExceptionTranslationPostPro
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.2.0 * @since 1.2.0
*/ */
@Configuration
@ConditionalOnClass(PersistenceExceptionTranslationPostProcessor.class) @ConditionalOnClass(PersistenceExceptionTranslationPostProcessor.class)
public class PersistenceExceptionTranslationAutoConfiguration { public class PersistenceExceptionTranslationAutoConfiguration {

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,6 +29,7 @@ import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter; import org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.AbstractHttpMessageConverter; import org.springframework.http.converter.AbstractHttpMessageConverter;
@ -41,6 +42,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@Configuration
public class HypermediaHttpMessageConverterConfiguration { public class HypermediaHttpMessageConverterConfiguration {
@Bean @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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,6 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DatabaseDriver; import org.springframework.boot.jdbc.DatabaseDriver;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/** /**
* Actual DataSource configurations imported by {@link DataSourceAutoConfiguration}. * Actual DataSource configurations imported by {@link DataSourceAutoConfiguration}.
@ -45,6 +46,7 @@ abstract class DataSourceConfiguration {
/** /**
* Tomcat Pool DataSource configuration. * Tomcat Pool DataSource configuration.
*/ */
@Configuration
@ConditionalOnClass(org.apache.tomcat.jdbc.pool.DataSource.class) @ConditionalOnClass(org.apache.tomcat.jdbc.pool.DataSource.class)
@ConditionalOnMissingBean(DataSource.class) @ConditionalOnMissingBean(DataSource.class)
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.tomcat.jdbc.pool.DataSource", matchIfMissing = true) @ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.tomcat.jdbc.pool.DataSource", matchIfMissing = true)
@ -71,6 +73,7 @@ abstract class DataSourceConfiguration {
/** /**
* Hikari DataSource configuration. * Hikari DataSource configuration.
*/ */
@Configuration
@ConditionalOnClass(HikariDataSource.class) @ConditionalOnClass(HikariDataSource.class)
@ConditionalOnMissingBean(DataSource.class) @ConditionalOnMissingBean(DataSource.class)
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "com.zaxxer.hikari.HikariDataSource", matchIfMissing = true) @ConditionalOnProperty(name = "spring.datasource.type", havingValue = "com.zaxxer.hikari.HikariDataSource", matchIfMissing = true)
@ -89,6 +92,7 @@ abstract class DataSourceConfiguration {
* *
* @deprecated as of 1.5 in favor of DBCP2 * @deprecated as of 1.5 in favor of DBCP2
*/ */
@Configuration
@ConditionalOnClass(org.apache.commons.dbcp.BasicDataSource.class) @ConditionalOnClass(org.apache.commons.dbcp.BasicDataSource.class)
@ConditionalOnMissingBean(DataSource.class) @ConditionalOnMissingBean(DataSource.class)
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.commons.dbcp.BasicDataSource", matchIfMissing = true) @ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.commons.dbcp.BasicDataSource", matchIfMissing = true)
@ -116,6 +120,7 @@ abstract class DataSourceConfiguration {
/** /**
* DBCP DataSource configuration. * DBCP DataSource configuration.
*/ */
@Configuration
@ConditionalOnClass(org.apache.commons.dbcp2.BasicDataSource.class) @ConditionalOnClass(org.apache.commons.dbcp2.BasicDataSource.class)
@ConditionalOnMissingBean(DataSource.class) @ConditionalOnMissingBean(DataSource.class)
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.commons.dbcp2.BasicDataSource", matchIfMissing = true) @ConditionalOnProperty(name = "spring.datasource.type", havingValue = "org.apache.commons.dbcp2.BasicDataSource", matchIfMissing = true)
@ -134,6 +139,7 @@ abstract class DataSourceConfiguration {
/** /**
* Generic DataSource configuration. * Generic DataSource configuration.
*/ */
@Configuration
@ConditionalOnMissingBean(DataSource.class) @ConditionalOnMissingBean(DataSource.class)
@ConditionalOnProperty(name = "spring.datasource.type") @ConditionalOnProperty(name = "spring.datasource.type")
static class Generic { static class Generic {

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -34,6 +34,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.jdbc.DatabaseDriver; import org.springframework.boot.jdbc.DatabaseDriver;
import org.springframework.boot.jta.XADataSourceWrapper; import org.springframework.boot.jta.XADataSourceWrapper;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
@ -46,6 +47,7 @@ import org.springframework.util.StringUtils;
* @author Josh Long * @author Josh Long
* @since 1.2.0 * @since 1.2.0
*/ */
@Configuration
@AutoConfigureBefore(DataSourceAutoConfiguration.class) @AutoConfigureBefore(DataSourceAutoConfiguration.class)
@EnableConfigurationProperties(DataSourceProperties.class) @EnableConfigurationProperties(DataSourceProperties.class)
@ConditionalOnClass({ DataSource.class, TransactionManager.class, @ConditionalOnClass({ DataSource.class, TransactionManager.class,

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -371,6 +371,7 @@ public class BatchAutoConfigurationTests {
} }
@EnableBatchProcessing @EnableBatchProcessing
@Configuration
protected static class NamedJobConfigurationWithRegisteredJob { protected static class NamedJobConfigurationWithRegisteredJob {
@Autowired @Autowired
@ -413,6 +414,7 @@ public class BatchAutoConfigurationTests {
} }
@EnableBatchProcessing @EnableBatchProcessing
@Configuration
protected static class NamedJobConfigurationWithLocalJob { protected static class NamedJobConfigurationWithLocalJob {
@Autowired @Autowired
@ -444,6 +446,7 @@ public class BatchAutoConfigurationTests {
} }
@Configuration
@EnableBatchProcessing @EnableBatchProcessing
protected static class JobConfiguration { protected static class JobConfiguration {

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -434,6 +434,7 @@ public class ConditionalOnPropertyTests {
} }
@Configuration
@ConditionalOnMyFeature @ConditionalOnMyFeature
protected static class MetaAnnotation { protected static class MetaAnnotation {
@ -444,6 +445,7 @@ public class ConditionalOnPropertyTests {
} }
@Configuration
@ConditionalOnMyFeature @ConditionalOnMyFeature
@ConditionalOnProperty(prefix = "my.other.feature", name = "enabled", havingValue = "true", matchIfMissing = false) @ConditionalOnProperty(prefix = "my.other.feature", name = "enabled", havingValue = "true", matchIfMissing = false)
protected static class MetaAnnotationAndDirectAnnotation { protected static class MetaAnnotationAndDirectAnnotation {

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,6 +33,7 @@ import org.springframework.boot.autoconfigure.jndi.TestableInitialContextFactory
import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jmx.export.MBeanExporter; import org.springframework.jmx.export.MBeanExporter;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -167,7 +168,8 @@ public class JndiDataSourceAutoConfigurationTests {
TestableInitialContextFactory.bind(name, dataSource); TestableInitialContextFactory.bind(name, dataSource);
} }
private static class MBeanExporterConfiguration { @Configuration
static class MBeanExporterConfiguration {
@Bean @Bean
MBeanExporter mbeanExporter() { MBeanExporter mbeanExporter() {
@ -176,7 +178,8 @@ public class JndiDataSourceAutoConfigurationTests {
} }
private static class AnotherMBeanExporterConfiguration { @Configuration
static class AnotherMBeanExporterConfiguration {
@Bean @Bean
MBeanExporter anotherMbeanExporter() { MBeanExporter anotherMbeanExporter() {

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,6 +29,7 @@ import org.junit.Test;
import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.KafkaHeaders; import org.springframework.kafka.support.KafkaHeaders;
@ -98,6 +99,7 @@ public class KafkaAutoConfigurationIntegrationTests {
return File.separatorChar == '\\'; return File.separatorChar == '\\';
} }
@Configuration
public static class KafkaConfig { public static class KafkaConfig {
@Bean @Bean

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -324,6 +324,7 @@ public class ResourceServerTokenServicesConfigurationTests {
} }
@Configuration
@Import({ OAuth2RestOperationsConfiguration.class }) @Import({ OAuth2RestOperationsConfiguration.class })
protected static class ResourceNoClientConfiguration extends ResourceConfiguration { protected static class ResourceNoClientConfiguration extends ResourceConfiguration {
@ -351,6 +352,7 @@ public class ResourceServerTokenServicesConfigurationTests {
} }
@Configuration
@Import({ FacebookAutoConfiguration.class, SocialWebAutoConfiguration.class }) @Import({ FacebookAutoConfiguration.class, SocialWebAutoConfiguration.class })
protected static class SocialResourceConfiguration extends ResourceConfiguration { protected static class SocialResourceConfiguration extends ResourceConfiguration {

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -373,6 +373,7 @@ public class MultipartAutoConfigurationTests {
} }
@Configuration
public static class ContainerWithCustomMultipartResolver { public static class ContainerWithCustomMultipartResolver {
@Bean @Bean
@ -382,6 +383,7 @@ public class MultipartAutoConfigurationTests {
} }
@Configuration
public static class ContainerWithCommonsMultipartResolver { public static class ContainerWithCommonsMultipartResolver {
@Bean @Bean

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -89,6 +89,7 @@ public class WebSocketAutoConfigurationTests {
} }
@Configuration
static class CommonConfiguration { static class CommonConfiguration {
@Bean @Bean

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -133,6 +133,7 @@ public class RemoteClientConfiguration {
/** /**
* LiveReload configuration. * LiveReload configuration.
*/ */
@Configuration
@ConditionalOnProperty(prefix = "spring.devtools.livereload", name = "enabled", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.devtools.livereload", name = "enabled", matchIfMissing = true)
static class LiveReloadConfiguration { static class LiveReloadConfiguration {
@ -179,6 +180,7 @@ public class RemoteClientConfiguration {
/** /**
* Client configuration for remote update and restarts. * Client configuration for remote update and restarts.
*/ */
@Configuration
@ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.devtools.remote.restart", name = "enabled", matchIfMissing = true)
static class RemoteRestartClientConfiguration { static class RemoteRestartClientConfiguration {
@ -242,6 +244,7 @@ public class RemoteClientConfiguration {
/** /**
* Client configuration for remote debug HTTP tunneling. * Client configuration for remote debug HTTP tunneling.
*/ */
@Configuration
@ConditionalOnProperty(prefix = "spring.devtools.remote.debug", name = "enabled", matchIfMissing = true) @ConditionalOnProperty(prefix = "spring.devtools.remote.debug", name = "enabled", matchIfMissing = true)
@ConditionalOnClass(Filter.class) @ConditionalOnClass(Filter.class)
@Conditional(LocalDebugPortAvailableCondition.class) @Conditional(LocalDebugPortAvailableCondition.class)

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,6 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.dsl.IntegrationFlow; import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows; import org.springframework.integration.dsl.IntegrationFlows;
@ -41,6 +42,7 @@ public class SampleParentContextApplication {
.child(SampleParentContextApplication.class).run(args); .child(SampleParentContextApplication.class).run(args);
} }
@Configuration
@EnableAutoConfiguration @EnableAutoConfiguration
protected static class Parent { protected static class Parent {

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -70,8 +70,9 @@ public class JsonTestersAutoConfiguration {
null); null);
} }
@Configuration
@ConditionalOnClass(ObjectMapper.class) @ConditionalOnClass(ObjectMapper.class)
private static class JacksonJsonTestersConfiguration { static class JacksonJsonTestersConfiguration {
@Bean @Bean
@Scope("prototype") @Scope("prototype")
@ -84,8 +85,9 @@ public class JsonTestersAutoConfiguration {
} }
@Configuration
@ConditionalOnClass(Gson.class) @ConditionalOnClass(Gson.class)
private static class GsonJsonTestersConfiguration { static class GsonJsonTestersConfiguration {
@Bean @Bean
@Scope("prototype") @Scope("prototype")

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -242,6 +242,7 @@ public class BeanCurrentlyInCreationFailureAnalyzerTests {
return new BeanOne(); return new BeanOne();
} }
@org.springframework.context.annotation.Configuration
public static class BeanTwoConfiguration { public static class BeanTwoConfiguration {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -255,6 +256,7 @@ public class BeanCurrentlyInCreationFailureAnalyzerTests {
} }
@org.springframework.context.annotation.Configuration
public static class BeanThreeConfiguration { public static class BeanThreeConfiguration {
@Bean @Bean

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2016 the original author or authors. * Copyright 2012-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -154,6 +154,7 @@ public class NoUniqueBeanDefinitionFailureAnalyzerTests {
} }
@Configuration
static class ParentProducer { static class ParentProducer {
@Bean @Bean

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -32,6 +32,7 @@ import org.junit.Test;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -66,6 +67,7 @@ public class ServletContextInitializerBeansTests {
this.context = new AnnotationConfigApplicationContext(configuration); this.context = new AnnotationConfigApplicationContext(configuration);
} }
@Configuration
static class ServletConfiguration { static class ServletConfiguration {
@Bean @Bean
@ -75,6 +77,7 @@ public class ServletContextInitializerBeansTests {
} }
@Configuration
static class FilterConfiguration { static class FilterConfiguration {
@Bean @Bean

Loading…
Cancel
Save