spring-framework / org.springframework.test.context.support / AnnotationConfigContextLoaderUtils / detectDefaultConfigurationClasses

detectDefaultConfigurationClasses

open static fun detectDefaultConfigurationClasses(declaringClass: Class<*>): Array<Class<*>>

Detect the default configuration classes for the supplied test class.

The returned class array will contain all static nested classes of the supplied class that meet the requirements for @Configuration class implementations as specified in the documentation for Configuration.

The implementation of this method adheres to the contract defined in the org.springframework.test.context.SmartContextLoader SPI. Specifically, this method uses introspection to detect default configuration classes that comply with the constraints required of @Configuration class implementations. If a potential candidate configuration class does not meet these requirements, this method will log a debug message, and the potential candidate class will be ignored.

Parameters

declaringClass - the test class that declared @ContextConfiguration

Return
an array of default configuration classes, potentially empty but never null