camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-9866) @PropertyInject doesn't work with Spring-Boot
Date Wed, 13 Apr 2016 20:58:25 GMT

    [ 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 <tomasrohovsky@seznam.cz>
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)

Mime
View raw message