Avoid classpath scanning in test
This commit updates SpringConfiguratorTests to not rely on classpath scanning as it could have side effect. In this particular case, the configuration class that sources the scan is detected again, leading to bean overriding. Irrespective of that, adding more code in that package may have side effect as they could be scanned as well. Closes gh-32535
This commit is contained in:
@@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
@@ -84,7 +84,7 @@ public class SpringConfiguratorTests {
|
||||
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackageClasses=SpringConfiguratorTests.class)
|
||||
@Import(ComponentEchoEndpoint.class)
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user