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:
@@ -67,7 +67,6 @@ public class AvroMessageConverterSerializationTests {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
System.setProperty("--spring.main.allow-bean-definition-overriding", "true");
|
||||
schemaRegistryServerContext = SpringApplication
|
||||
.run(SchemaRegistryServerApplication.class);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -53,11 +52,6 @@ public class AvroSchemaMessageConverterTests {
|
||||
|
||||
static StubSchemaRegistryClient stubSchemaRegistryClient = new StubSchemaRegistryClient();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
System.setProperty("--spring.main.allow-bean-definition-overriding", "true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessageWithLocation() throws Exception {
|
||||
ConfigurableApplicationContext sourceContext = SpringApplication.run(AvroSourceApplication.class,
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
@@ -57,11 +56,6 @@ public class AvroSchemaRegistryClientMessageConverterTests {
|
||||
|
||||
static SchemaRegistryClient stubSchemaRegistryClient = new StubSchemaRegistryClient();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
System.setProperty("--spring.main.allow-bean-definition-overriding", "true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Exception {
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -46,11 +45,6 @@ public class AvroStubSchemaRegistryClientMessageConverterTests {
|
||||
|
||||
static SchemaRegistryClient stubSchemaRegistryClient = new StubSchemaRegistryClient();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
System.setProperty("--spring.main.allow-bean-definition-overriding", "true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Exception {
|
||||
ConfigurableApplicationContext sourceContext = SpringApplication.run(AvroSourceApplication.class,
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.cloud.schema.avro;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -43,11 +42,6 @@ public class SubjectNamingStrategyTest {
|
||||
|
||||
static StubSchemaRegistryClient stubSchemaRegistryClient = new StubSchemaRegistryClient();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
System.setProperty("--spring.main.allow-bean-definition-overriding", "true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomNamingStrategy() throws Exception {
|
||||
ConfigurableApplicationContext sourceContext = SpringApplication.run(AvroSourceApplication.class,
|
||||
|
||||
Reference in New Issue
Block a user