INT-4551: Fail if old Java DSL jar is present

JIRA: https://jira.spring.io/browse/INT-4551

**Cherry-pick to 5.0.x**
This commit is contained in:
Artem Bilan
2018-11-08 13:33:23 -05:00
committed by Gary Russell
parent 433ef4c4aa
commit 2d06169f25

View File

@@ -22,6 +22,7 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.ManagedSet;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.integration.aop.PublisherAnnotationBeanPostProcessor;
@@ -29,6 +30,7 @@ import org.springframework.integration.config.annotation.MessagingAnnotationPost
import org.springframework.integration.context.IntegrationContextUtils;
import org.springframework.integration.context.IntegrationProperties;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
/**
* {@link ImportBeanDefinitionRegistrar} implementation that configures integration infrastructure.
@@ -40,6 +42,17 @@ import org.springframework.lang.Nullable;
*/
public class IntegrationRegistrar implements ImportBeanDefinitionRegistrar {
static {
if (ClassUtils.isPresent("org.springframework.integration.dsl.support.Function",
IntegrationRegistrar.class.getClassLoader())) {
throw new ApplicationContextException("Starting with Spring Integration 5.0, "
+ "the 'spring-integration-java-dsl' dependency is no longer needed; "
+ "the Java DSL has been merged into the core project. "
+ "Having it present it on the classpath causes class loading conflicts.");
}
}
/**
* Invoked by the framework when an @EnableIntegration annotation is encountered.
* Also called with {@code null} {@code importingClassMetadata} from {@code AbstractIntegrationNamespaceHandler}