Document visibility requirements for Bean Overrides
This commit makes it clear that there are no visibility requirements for @TestBean fields or factory methods as well as @MockitoBean or @MockitoSpyBean fields. Closes gh-33923
This commit is contained in:
@@ -105,6 +105,11 @@ import org.springframework.test.context.bean.override.BeanOverride;
|
||||
* FactoryBean}, the {@code FactoryBean} will be replaced with a singleton bean
|
||||
* corresponding to the value returned from the {@code @TestBean} factory method.
|
||||
*
|
||||
* <p>There are no restrictions on the visibility of {@code @TestBean} fields or
|
||||
* factory methods. Such fields and methods can therefore be {@code public},
|
||||
* {@code protected}, package-private (default visibility), or {@code private}
|
||||
* depending on the needs or coding practices of the project.
|
||||
*
|
||||
* @author Simon Baslé
|
||||
* @author Stephane Nicoll
|
||||
* @author Sam Brannen
|
||||
|
||||
@@ -58,6 +58,11 @@ import org.springframework.test.context.bean.override.BeanOverride;
|
||||
* FactoryBean}, the {@code FactoryBean} will be replaced with a singleton mock
|
||||
* of the type of object created by the {@code FactoryBean}.
|
||||
*
|
||||
* <p>There are no restrictions on the visibility of a {@code @MockitoBean} field.
|
||||
* Such fields can therefore be {@code public}, {@code protected}, package-private
|
||||
* (default visibility), or {@code private} depending on the needs or coding
|
||||
* practices of the project.
|
||||
*
|
||||
* @author Simon Baslé
|
||||
* @author Sam Brannen
|
||||
* @since 6.2
|
||||
|
||||
@@ -51,6 +51,11 @@ import org.springframework.test.context.bean.override.BeanOverride;
|
||||
* a spy will be created for the object created by the {@code FactoryBean}, not
|
||||
* for the {@code FactoryBean} itself.
|
||||
*
|
||||
* <p>There are no restrictions on the visibility of a {@code @MockitoSpyBean} field.
|
||||
* Such fields can therefore be {@code public}, {@code protected}, package-private
|
||||
* (default visibility), or {@code private} depending on the needs or coding
|
||||
* practices of the project.
|
||||
*
|
||||
* @author Simon Baslé
|
||||
* @author Sam Brannen
|
||||
* @since 6.2
|
||||
|
||||
Reference in New Issue
Block a user