Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B557B1962C for ; Wed, 13 Apr 2016 21:03:25 +0000 (UTC) Received: (qmail 51630 invoked by uid 500); 13 Apr 2016 21:03:25 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 51589 invoked by uid 500); 13 Apr 2016 21:03:25 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 51579 invoked by uid 99); 13 Apr 2016 21:03:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Apr 2016 21:03:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 70F2A2C1F5A for ; Wed, 13 Apr 2016 21:03:25 +0000 (UTC) Date: Wed, 13 Apr 2016 21:03:25 +0000 (UTC) From: "Tomas Rohovsky (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-9866) @PropertyInject doesn't work with Spring-Boot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-9866?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tomas Rohovsky updated CAMEL-9866: ---------------------------------- Component/s: (was: camel-core) camel-spring-boot > @PropertyInject doesn't work with Spring-Boot > --------------------------------------------- > > Key: CAMEL-9866 > URL: https://issues.apache.org/jira/browse/CAMEL-9866 > Project: Camel > Issue Type: Bug > Components: camel-spring-boot > Affects Versions: 2.16.3, 2.17.0 > Reporter: Jussi Nupponen > Assignee: Tomas Rohovsky > > When I upgraded Camel Spring-Boot project to use Camel 2.16.3 from Camel 2.16.2 the @PropertyInject annotations broke. > The problem occurs when using the annotation in a Spring-Boot application like this > {code:java} > @SpringBootApplication > public class MySpringBootRouter extends FatJarRouter { > @PropertyInject("inject-value") > private String injectedValue; > > @Override > public void configure() { > from("timer:trigger") > .log("PropertyInject: "+injectedValue); > } > } > {code} > Running the code above with command > {noformat} > mvn spring-boot:run > {noformat} > causes the following exception: > {noformat} > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478) > at java.lang.Thread.run(Thread.java:745) > Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySpringBootRouter': Initialization of bean failed; nested exception is org.apache.camel.spring.GenericBeansException: Error post processing bean: mySpringBootRouter; nested exception is org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: Cannot add component as its already previously added: properties > at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) > at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) > at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) > at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) > at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) > at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) > at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) > at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) > at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) > at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) > at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) > at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) > at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) > at org.apache.camel.spring.boot.FatJarRouter.main(FatJarRouter.java:26) > ... 6 more > Caused by: org.apache.camel.spring.GenericBeansException: Error post processing bean: mySpringBootRouter; nested exception is org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: Cannot add component as its already previously added: properties > at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:154) > at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) > at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) > at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) > ... 19 more > Caused by: org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: Cannot add component as its already previously added: properties > at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1680) > at org.apache.camel.impl.CamelPostProcessorHelper.getInjectionPropertyValue(CamelPostProcessorHelper.java:263) > at org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFieldProperty(DefaultCamelBeanPostProcessor.java:206) > at org.apache.camel.impl.DefaultCamelBeanPostProcessor$1.doWith(DefaultCamelBeanPostProcessor.java:172) > at org.apache.camel.util.ReflectionHelper.doWithFields(ReflectionHelper.java:73) > at org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFields(DefaultCamelBeanPostProcessor.java:168) > at org.apache.camel.impl.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:82) > at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:148) > ... 22 more > Caused by: java.lang.IllegalArgumentException: Cannot add component as its already previously added: properties > at org.apache.camel.impl.DefaultCamelContext.addComponent(DefaultCamelContext.java:370) > at org.apache.camel.util.CamelContextHelper.lookupPropertiesComponent(CamelContextHelper.java:578) > at org.apache.camel.impl.CamelPostProcessorHelper.getInjectionPropertyValue(CamelPostProcessorHelper.java:237) > ... 28 more > {noformat} > Using placeholders like {noformat}.log("{{inject-value}}"){noformat} still works just as before. I tried to browse through changes between 2.16.2 and 2.16.3 but I didn't catch any obvious reason for this problem. > I created a runnable demo of the problem here: https://github.com/jnupponen/camel-properties-component-spring-boot-problem -- This message was sent by Atlassian JIRA (v6.3.4#6332)