Repository: camel Updated Branches: refs/heads/master dd202bc24 -> 9c969b510
[Spring Boot] Improved configuration. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9c969b51 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9c969b51 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9c969b51 Branch: refs/heads/master Commit: 9c969b510801ffc82692d75e9b9cc8dda64984ae Parents: dd202bc Author: Henryk Konsek <[email protected]> Authored: Mon Jan 5 19:12:58 2015 +0100 Committer: Henryk Konsek <[email protected]> Committed: Mon Jan 5 19:12:58 2015 +0100 ---------------------------------------------------------------------- .../spring/boot/CamelAutoConfiguration.java | 5 +-- .../SpringConversionServiceConfiguration.java | 6 ++- .../spring/boot/CamelAutoConfigurationTest.java | 2 +- .../camel/spring/boot/NoConvertersTest.java | 46 ++++++++++++++++++++ 4 files changed, 52 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/9c969b51/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java index 735944c..bb0bf6d 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java @@ -39,12 +39,9 @@ public class CamelAutoConfiguration { */ @Bean CamelContext camelContext(ApplicationContext applicationContext, - CamelConfigurationProperties configurationProperties, - SpringTypeConverter springTypeConverter) { + CamelConfigurationProperties configurationProperties) { CamelContext camelContext = new SpringCamelContext(applicationContext); - camelContext.getTypeConverterRegistry().addFallbackTypeConverter(springTypeConverter, true); - if (!configurationProperties.isJmxEnabled()) { camelContext.disableJMX(); } http://git-wip-us.apache.org/repos/asf/camel/blob/9c969b51/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringConversionServiceConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringConversionServiceConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringConversionServiceConfiguration.java index 732dc89..1d5808a 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringConversionServiceConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SpringConversionServiceConfiguration.java @@ -49,8 +49,10 @@ public class SpringConversionServiceConfiguration { } @Bean - SpringTypeConverter springTypeConverter(ConversionService[] conversionServices) { - return new SpringTypeConverter(asList(conversionServices)); + SpringTypeConverter springTypeConverter(CamelContext camelContext, ConversionService[] conversionServices) { + SpringTypeConverter springTypeConverter = new SpringTypeConverter(asList(conversionServices)); + camelContext.getTypeConverterRegistry().addFallbackTypeConverter(springTypeConverter, true); + return springTypeConverter; } } http://git-wip-us.apache.org/repos/asf/camel/blob/9c969b51/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java index d1f3b60..50595fa 100644 --- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.verify; @EnableAutoConfiguration @SpringApplicationConfiguration(classes = {TestConfig.class, CamelAutoConfigurationTest.class, RouteConfigWithCamelContextInjected.class}) @IntegrationTest({ - "camel.springboot.consumerTemplateCacheSize:100", + "camel.springboot.consumerTemplateCacheSize=100", "camel.springboot.jmxEnabled=false"}) public class CamelAutoConfigurationTest extends Assert { http://git-wip-us.apache.org/repos/asf/camel/blob/9c969b51/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/NoConvertersTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/NoConvertersTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/NoConvertersTest.java new file mode 100644 index 0000000..e27ec54 --- /dev/null +++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/NoConvertersTest.java @@ -0,0 +1,46 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.boot; + +import org.apache.camel.TypeConverter; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.IntegrationTest; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@EnableAutoConfiguration +@SpringApplicationConfiguration(classes = NoConvertersTest.class) +@IntegrationTest("camel.springboot.typeConversion=false") +public class NoConvertersTest extends Assert { + + @Autowired + ApplicationContext applicationContext; + + @Test(expected = NoSuchBeanDefinitionException.class) + public void shouldNotProvideConverter() { + applicationContext.getBean(TypeConverter.class); + } + +} +
