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 6d523e2a70
commit ce42e56d7e

View File

@@ -38,6 +38,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.ManagedList;
import org.springframework.beans.factory.support.ManagedSet;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
@@ -85,6 +86,17 @@ public class IntegrationRegistrar implements ImportBeanDefinitionRegistrar, Bean
this.classLoader = classLoader;
}
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}