Add missing method BeanDefinitionBuilder.setFallback()
This commit is contained in:
parent
9a1e5eb8d7
commit
246ebd24bf
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 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,6 +34,7 @@ import org.springframework.util.ObjectUtils;
|
|||
* @author Rod Johnson
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
* @author Yanming Zhou
|
||||
* @since 2.0
|
||||
*/
|
||||
public final class BeanDefinitionBuilder {
|
||||
|
@ -348,6 +349,15 @@ public final class BeanDefinitionBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether this bean is a fallback autowire candidate.
|
||||
* @since 6.2
|
||||
*/
|
||||
public BeanDefinitionBuilder setFallback(boolean fallback) {
|
||||
this.beanDefinition.setFallback(fallback);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the role of this definition.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2024 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 static org.assertj.core.api.Assertions.assertThat;
|
|||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Stephane Nicoll
|
||||
* @author Yanming Zhou
|
||||
*/
|
||||
class BeanDefinitionBuilderTests {
|
||||
|
||||
|
@ -125,6 +126,12 @@ class BeanDefinitionBuilderTests {
|
|||
.setPrimary(true).getBeanDefinition().isPrimary()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void builderWithFallback() {
|
||||
assertThat(BeanDefinitionBuilder.rootBeanDefinition(TestBean.class)
|
||||
.setFallback(true).getBeanDefinition().isFallback()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void builderWithRole() {
|
||||
assertThat(BeanDefinitionBuilder.rootBeanDefinition(TestBean.class)
|
||||
|
|
Loading…
Reference in New Issue