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:
parent
5b660da52d
commit
c1ed504ac1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue