List of usage examples for org.springframework.integration.config IntegrationConfigUtils BASE_PACKAGE
String BASE_PACKAGE
To view the source code for org.springframework.integration.config IntegrationConfigUtils BASE_PACKAGE.
Click Source Link
From source file:org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor.java
/** * Register a null channel in the given BeanDefinitionRegistry. The bean name is defined by the constant * {@link IntegrationContextUtils#NULL_CHANNEL_BEAN_NAME}. *///from ww w .j a v a 2s . c o m private void registerNullChannel(BeanDefinitionRegistry registry) { if (registry.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { BeanDefinition nullChannelDefinition = registry .getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); if (NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) { return; } else { throw new IllegalStateException( "The bean name '" + IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME + "' is reserved."); } } else { RootBeanDefinition nullChannelDef = new RootBeanDefinition(); nullChannelDef.setBeanClassName(IntegrationConfigUtils.BASE_PACKAGE + ".channel.NullChannel"); BeanDefinitionHolder nullChannelHolder = new BeanDefinitionHolder(nullChannelDef, IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); BeanDefinitionReaderUtils.registerBeanDefinition(nullChannelHolder, registry); } }
From source file:org.springframework.integration.config.IntegrationRegistrar.java
/** * Register {@code jsonPath} and {@code xpath} SpEL-function beans, if necessary. * @param registry The {@link BeanDefinitionRegistry} to register additional {@link BeanDefinition}s. *//*from w w w . j a va 2 s . co m*/ private void registerBuiltInBeans(BeanDefinitionRegistry registry) { int registryId = System.identityHashCode(registry); String jsonPathBeanName = "jsonPath"; boolean alreadyRegistered = false; if (registry instanceof ListableBeanFactory) { alreadyRegistered = ((ListableBeanFactory) registry).containsBean(jsonPathBeanName); } else { alreadyRegistered = registry.isBeanNameInUse(jsonPathBeanName); } if (!alreadyRegistered && !registriesProcessed.contains(registryId)) { Class<?> jsonPathClass = null; try { jsonPathClass = ClassUtils.forName("com.jayway.jsonpath.JsonPath", this.classLoader); } catch (ClassNotFoundException e) { logger.debug("The '#jsonPath' SpEL function cannot be registered: " + "there is no jayway json-path.jar on the classpath."); } if (jsonPathClass != null) { try { ClassUtils.forName("com.jayway.jsonpath.Predicate", this.classLoader); } catch (ClassNotFoundException e) { jsonPathClass = null; logger.warn("The '#jsonPath' SpEL function cannot be registered. " + "An old json-path.jar version is detected in the classpath." + "At least 1.2.0 is required; see version information at: " + "https://github.com/jayway/JsonPath/releases", e); } } if (jsonPathClass != null) { IntegrationConfigUtils.registerSpelFunctionBean(registry, jsonPathBeanName, IntegrationConfigUtils.BASE_PACKAGE + ".json.JsonPathUtils", "evaluate"); } } alreadyRegistered = false; String xpathBeanName = "xpath"; if (registry instanceof ListableBeanFactory) { alreadyRegistered = ((ListableBeanFactory) registry).containsBean(xpathBeanName); } else { alreadyRegistered = registry.isBeanNameInUse(xpathBeanName); } if (!alreadyRegistered && !registriesProcessed.contains(registryId)) { Class<?> xpathClass = null; try { xpathClass = ClassUtils.forName(IntegrationConfigUtils.BASE_PACKAGE + ".xml.xpath.XPathUtils", this.classLoader); } catch (ClassNotFoundException e) { logger.debug("SpEL function '#xpath' isn't registered: " + "there is no spring-integration-xml.jar on the classpath."); } if (xpathClass != null) { IntegrationConfigUtils.registerSpelFunctionBean(registry, xpathBeanName, IntegrationConfigUtils.BASE_PACKAGE + ".xml.xpath.XPathUtils", "evaluate"); } } alreadyRegistered = false; if (registry instanceof ListableBeanFactory) { alreadyRegistered = ((ListableBeanFactory) registry).containsBean( IntegrationContextUtils.TO_STRING_FRIENDLY_JSON_NODE_TO_STRING_CONVERTER_BEAN_NAME); } else { alreadyRegistered = registry.isBeanNameInUse( IntegrationContextUtils.TO_STRING_FRIENDLY_JSON_NODE_TO_STRING_CONVERTER_BEAN_NAME); } if (!alreadyRegistered && !registriesProcessed.contains(registryId) && this.jackson2Present) { registry.registerBeanDefinition( IntegrationContextUtils.TO_STRING_FRIENDLY_JSON_NODE_TO_STRING_CONVERTER_BEAN_NAME, BeanDefinitionBuilder.genericBeanDefinition( IntegrationConfigUtils.BASE_PACKAGE + ".json.ToStringFriendlyJsonNodeToStringConverter") .getBeanDefinition()); INTEGRATION_CONVERTER_INITIALIZER.registerConverter(registry, new RuntimeBeanReference( IntegrationContextUtils.TO_STRING_FRIENDLY_JSON_NODE_TO_STRING_CONVERTER_BEAN_NAME)); } registriesProcessed.add(registryId); }