Browse Source

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
pull/32536/head
Stéphane Nicoll 2 years ago
parent
commit
c1ed504ac1
  1. 4
      spring-websocket/src/test/java/org/springframework/web/socket/server/standard/SpringConfiguratorTests.java

4
spring-websocket/src/test/java/org/springframework/web/socket/server/standard/SpringConfiguratorTests.java

@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test; @@ -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 { @@ -84,7 +84,7 @@ public class SpringConfiguratorTests {
@Configuration
@ComponentScan(basePackageClasses=SpringConfiguratorTests.class)
@Import(ComponentEchoEndpoint.class)
static class Config {
@Bean

Loading…
Cancel
Save