Make @IntegrationConverter Native compatible (#3551)
* Make `@IntegrationConverter` Native compatible * Add `BASE_PACKAGE` into an `IntegrationContextUtils`; deprecate similar in the `IntegrationConfigUtils`. This fixes a package tangle between `config` and `context` * Move `ConverterRegistrar` and `CustomConversionServiceFactoryBean` into a `config` package since they are package protected and created their instances in the `IntegrationConverterInitializer` functional way instead of reflection * Use new `IntegrationContextUtils.BASE_PACKAGE` constant instead of deprecated one * Make `DefaultConfiguringBeanFactoryPostProcessor` `public` to make it available for Spring Native `trigger` option in the `@NativeHint` declaration * Simplify logic around `JsonPath` to just a `ClassUtils.isPresent()` * Move the `@IntegrationConverter` processing logic into the `ConverterRegistrar` to avoid reflection via `BeanDefinition` ctor arg manipulation * Move the reflection logic into a `ConverterParser` which, being a part of XML configuration, is not going to be compatible with native any way * Mark `JsonNodeWrapperToJsonNodeConverter` with an `@IntegrationConverter` since it is not registered via reflection any more * Expose `MicrometerMetricsCaptorRegistrar.METER_REGISTRY_PRESENT` and use it in the `IntegrationGraphServer` * Extract `UnmarshallingTransformer.MIME_MESSAGE_PRESENT` for less reflection at runtime * Use `null` for a `ClassLoader` arg in the `ClassUtils.isPresent()` relying on the default one internally * * Fix Checkstyle violations
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,9 +21,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
@@ -40,20 +40,21 @@ import org.springframework.messaging.Message;
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gunnar Hillert
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MapToObjectTransformerTests {
|
||||
|
||||
private GenericApplicationContext context = TestUtils.createTestApplicationContext();
|
||||
private final GenericApplicationContext context = TestUtils.createTestApplicationContext();
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void prepare() {
|
||||
this.context.registerBeanDefinition(IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME,
|
||||
new RootBeanDefinition("org.springframework.integration.context.CustomConversionServiceFactoryBean"));
|
||||
new RootBeanDefinition("org.springframework.integration.config.CustomConversionServiceFactoryBean"));
|
||||
this.context.refresh();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void terDown() {
|
||||
this.context.close();
|
||||
}
|
||||
@@ -172,6 +173,7 @@ public class MapToObjectTransformerTests {
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Address {
|
||||
@@ -185,6 +187,7 @@ public class MapToObjectTransformerTests {
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class StringToAddressConverter implements Converter<String, Address> {
|
||||
@@ -195,5 +198,7 @@ public class MapToObjectTransformerTests {
|
||||
address.setStreet(source);
|
||||
return address;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user