Merge branch '2.5.x'
Closes gh-27758
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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 static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public class AutoConfigurationPackagesTests {
|
||||
class AutoConfigurationPackagesTests {
|
||||
|
||||
@Test
|
||||
void setAndGet() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.boot.autoconfigure.condition.scan.ScanBean;
|
||||
import org.springframework.boot.autoconfigure.condition.scan.ScannedFactoryBeanConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.scan.ScannedFactoryBeanWithBeanMethodArgumentsConfiguration;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
@@ -60,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public class ConditionalOnMissingBeanTests {
|
||||
class ConditionalOnMissingBeanTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner();
|
||||
|
||||
@@ -161,7 +162,7 @@ public class ConditionalOnMissingBeanTests {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodConfiguration.class,
|
||||
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
|
||||
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
|
||||
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -169,7 +170,7 @@ public class ConditionalOnMissingBeanTests {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(ComponentScannedFactoryBeanBeanMethodWithArgumentsConfiguration.class,
|
||||
ConditionalOnFactoryBean.class, PropertyPlaceholderAutoConfiguration.class)
|
||||
.run((context) -> assertThat(context.getBean(ExampleBean.class).toString()).isEqualTo("fromFactory"));
|
||||
.run((context) -> assertThat(context.getBean(ScanBean.class).toString()).isEqualTo("fromFactory"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -617,9 +618,9 @@ public class ConditionalOnMissingBeanTests {
|
||||
|
||||
}
|
||||
|
||||
public static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
|
||||
static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
|
||||
|
||||
public ExampleFactoryBean(String value) {
|
||||
ExampleFactoryBean(String value) {
|
||||
Assert.state(!value.contains("$"), "value should not contain '$'");
|
||||
}
|
||||
|
||||
@@ -738,11 +739,11 @@ public class ConditionalOnMissingBeanTests {
|
||||
}
|
||||
|
||||
@TestAnnotation
|
||||
public static class ExampleBean {
|
||||
static class ExampleBean {
|
||||
|
||||
private String value;
|
||||
|
||||
public ExampleBean(String value) {
|
||||
ExampleBean(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2012-2021 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.condition.scan;
|
||||
|
||||
public class ScanBean {
|
||||
|
||||
private String value;
|
||||
|
||||
public ScanBean(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2012-2021 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.condition.scan;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
class ScanFactoryBean implements FactoryBean<ScanBean> {
|
||||
|
||||
ScanFactoryBean(String value) {
|
||||
Assert.state(!value.contains("$"), "value should not contain '$'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScanBean getObject() {
|
||||
return new ScanBean("fromFactory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return ScanBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
@@ -17,8 +17,6 @@
|
||||
package org.springframework.boot.autoconfigure.condition.scan;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBeanTests.ExampleBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBeanTests.ExampleFactoryBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -32,8 +30,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class ScannedFactoryBeanConfiguration {
|
||||
|
||||
@Bean
|
||||
public FactoryBean<ExampleBean> exampleBeanFactoryBean() {
|
||||
return new ExampleFactoryBean("foo");
|
||||
public FactoryBean<ScanBean> exampleBeanFactoryBean() {
|
||||
return new ScanFactoryBean("foo");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.condition.scan;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBeanTests.ExampleFactoryBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -35,8 +34,8 @@ public class ScannedFactoryBeanWithBeanMethodArgumentsConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ExampleFactoryBean exampleBeanFactoryBean(Foo foo) {
|
||||
return new ExampleFactoryBean("foo");
|
||||
public ScanFactoryBean exampleBeanFactoryBean(Foo foo) {
|
||||
return new ScanFactoryBean("foo");
|
||||
}
|
||||
|
||||
static class Foo {
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class LifecycleAutoConfigurationTests {
|
||||
class LifecycleAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(LifecycleAutoConfiguration.class));
|
||||
|
||||
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Brian Clozel
|
||||
*/
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
public class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
|
||||
class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
|
||||
|
||||
@Container
|
||||
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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 static org.mockito.Mockito.mock;
|
||||
* @author Brian Clozel
|
||||
*/
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
public class ReactiveElasticsearchRestClientAutoConfigurationTests {
|
||||
class ReactiveElasticsearchRestClientAutoConfigurationTests {
|
||||
|
||||
@Container
|
||||
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Stephane Nicoll
|
||||
* @author Michael J. Simons
|
||||
*/
|
||||
public class Neo4jReactiveRepositoriesAutoConfigurationTests {
|
||||
class Neo4jReactiveRepositoriesAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withUserConfiguration(MockedDriverConfiguration.class)
|
||||
|
||||
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@SpringBootTest
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
public class Neo4jRepositoriesAutoConfigurationIntegrationTests {
|
||||
class Neo4jRepositoriesAutoConfigurationIntegrationTests {
|
||||
|
||||
@Container
|
||||
private static final Neo4jContainer<?> neo4jServer = new Neo4jContainer<>(DockerImageNames.neo4j())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 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 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Kazuki Shimizu
|
||||
*/
|
||||
@ExtendWith(OutputCaptureExtension.class)
|
||||
public class FreeMarkerAutoConfigurationTests {
|
||||
class FreeMarkerAutoConfigurationTests {
|
||||
|
||||
private final BuildOutput buildOutput = new BuildOutput(getClass());
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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 static org.assertj.core.api.Assertions.assertThat;
|
||||
@ClassPathExclusions({ "jackson-databind*.jar", "jackson-dataformat-xml*.jar" })
|
||||
@ClassPathOverrides({ "com.fasterxml.jackson.core:jackson-databind:2.11.3",
|
||||
"com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.11.3" })
|
||||
public class Jackson211AutoConfigurationTests extends JacksonAutoConfigurationTests {
|
||||
class Jackson211AutoConfigurationTests extends JacksonAutoConfigurationTests {
|
||||
|
||||
public static final String STRATEGY_CLASS_NAME = "com.fasterxml.jackson.databind.PropertyNamingStrategy$SnakeCaseStrategy";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
@@ -17,11 +17,10 @@
|
||||
package org.springframework.boot.autoconfigure.packagestest.two;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurationPackage;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurationPackagesTests;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Sample configuration used in {@link AutoConfigurationPackagesTests}.
|
||||
* Sample configuration used in {@code AutoConfigurationPackagesTests}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class SqlInitializationAutoConfigurationTests {
|
||||
class SqlInitializationAutoConfigurationTests {
|
||||
|
||||
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(SqlInitializationAutoConfiguration.class)).withPropertyValues(
|
||||
|
||||
Reference in New Issue
Block a user