Spring Boot 2.1 upgrade related changes

* Instead of redefining `BinderTypeRegistry` as a bean in several tests, properly use spring.binders
  to define mock binders and then choose a default binder in tests in case of multiple binders in
  same spring.binders file.
* Remove `BindingServiceConfiguration` in `EnableBinding` and introduce it as a proper
  Spring Boot autoconfiguration class. Added `BindingServiceConfiguration` to spring.factories.
* Move `BinderFactory` bean into `BindingServiceConfiguration` and add `ConditionalOnMissingBean`
  on it so that downstream users can define new `BinderFactory` beans as part of autoconfiguration.
* Remove `ConditionalOnMissingBean` from the `BinderTypeRegistry` bean in `BinderFactoryConfiguration`
  as we don't expect this bean to be overridden.
* Remove previously added property `spring.main.allow-bean-definition-overriding` in several tests.
* Since web/actuator is optional now, remove unncecessarily setting server.port to `0` in tests
* Ensure that `BindersHealthIndicatorAutoConfiguration` is autoconfigured after `BindingServiceConfiguration`
  so that it has a `BinderFactory` available.
* Remove redefining `ServerController` bean in `SchemaServerConfiguration` as this is already created through
  component scanning and causing the bean overriding exceptions.
* Tests cleanup and polishing.

Resolves #1429, #1430
This commit is contained in:
Soby Chacko
2018-08-08 19:05:26 -04:00
parent 85b34be733
commit ae445e73ac
77 changed files with 242 additions and 413 deletions

View File

@@ -21,7 +21,6 @@ import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -55,11 +54,6 @@ public class StreamListenerReactiveInputOutputArgsTests {
this.configClass = configClass;
}
@Before
public void before() {
System.setProperty("spring.main.allow-bean-definition-overriding", "true");
}
@Parameterized.Parameters
public static Collection<?> InputConfigs() {
return Collections.singletonList(ReactorTestInputOutputArgs.class);

View File

@@ -16,7 +16,6 @@
package org.springframework.cloud.stream.reactive;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
@@ -38,11 +37,6 @@ import static org.springframework.cloud.stream.binding.StreamListenerErrorMessag
*/
public class StreamListenerReactiveMethodTests {
@Before
public void before() {
System.setProperty("spring.main.allow-bean-definition-overriding", "true");
}
@Test
public void testReactiveInvalidInputValueWithOutputMethodParameters() {
try {

View File

@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -56,11 +55,6 @@ public class StreamListenerReactiveMethodWithReturnTypeTests {
this.configClass = configClass;
}
@Before
public void before() {
System.setProperty("spring.main.allow-bean-definition-overriding", "true");
}
@Parameterized.Parameters
public static Collection<?> InputConfigs() {
return Arrays.asList(ReactorTestReturn1.class, ReactorTestReturn2.class, ReactorTestReturn3.class,

View File

@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -56,11 +55,6 @@ public class StreamListenerReactiveReturnWithFailureTests {
this.configClass = configClass;
}
@Before
public void before() {
System.setProperty("spring.main.allow-bean-definition-overriding", "true");
}
@Parameterized.Parameters
public static Collection<?> InputConfigs() {
return Arrays.asList(ReactorTestReturnWithFailure1.class, ReactorTestReturnWithFailure2.class,

View File

@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -62,11 +61,6 @@ public class StreamListenerReactiveReturnWithMessageTests {
ReactorTestReturnWithMessage3.class, ReactorTestReturnWithMessage4.class);
}
@Before
public void before() {
System.setProperty("spring.main.allow-bean-definition-overriding", "true");
}
@SuppressWarnings("unchecked")
private static void sendMessageAndValidate(ConfigurableApplicationContext context) throws InterruptedException {
Processor processor = context.getBean(Processor.class);