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 5F240195EE for ; Wed, 13 Apr 2016 20:58:26 +0000 (UTC) Received: (qmail 38189 invoked by uid 500); 13 Apr 2016 20:58:26 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 37890 invoked by uid 500); 13 Apr 2016 20:58:26 -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 37405 invoked by uid 99); 13 Apr 2016 20:58: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 20:58:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id BE7BB2C1F6B for ; Wed, 13 Apr 2016 20:58:25 +0000 (UTC) Date: Wed, 13 Apr 2016 20:58:25 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (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:comment-tabpanel&focusedCommentId=15240006#comment-15240006 ] ASF GitHub Bot commented on CAMEL-9866: --------------------------------------- GitHub user trohovsky opened a pull request: https://github.com/apache/camel/pull/945 CAMEL-9866 @PropertyInject doesn't work with Spring-Boot You can merge this pull request into a Git repository by running: $ git pull https://github.com/trohovsky/camel CAMEL-9866 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/945.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #945 ---- commit 805a59ee3af0db151b2af45e836698398433ba54 Author: Tomas Rohovsky Date: 2016-04-13T20:34:35Z CAMEL-9866 @PropertyInject doesn't work with 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-core > Affects Versions: 2.16.3, 2.17.0 > Reporter: Jussi Nupponen > > 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)