You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2019/06/25 13:23:01 UTC

[jira] [Commented] (CAMEL-13682) Wrong bean injection from OSGI

    [ https://issues.apache.org/jira/browse/CAMEL-13682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16872347#comment-16872347 ] 

Claus Ibsen commented on CAMEL-13682:
-------------------------------------

Camel 2.16 is EOL and not supported. Please test with latest version first and report back.

> Wrong bean injection from OSGI
> ------------------------------
>
>                 Key: CAMEL-13682
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13682
>             Project: Camel
>          Issue Type: Bug
>         Environment: Camel 2.16.1, Windows 10 x64, JbossFuse 6.2.1
>            Reporter: Adam Ostrožlík
>            Priority: Minor
>         Attachments: stacktrace.log
>
>
> We issued strange behaviour with our OSGI container setup using services - references and injecting services into out beans using @BeanInject
> *bundle1*
> {code:java}
> <!-- Both beans using same AuditStore interface -->
> <bean id="auditStore" class="store.AuditStoreImpl">
>  <property name="jdbcTemplate" ref="jdbcTemplate"/>
>  <tx:transaction method="*" value="Required"/>
> </bean>
> <bean id="auditStoreOut" class="store.AuditStoreOutImpl">
>  <property name="jdbcTemplate" ref="jdbcTemplate"/>
>  <tx:transaction method="*" value="Required"/>
> </bean>
> <service auto-export="interfaces" ref="auditStore"/>
> <service auto-export="interfaces" ref="auditStoreOut"/>
> {code}
>  
> *bundle2*
> {code:java}
> <reference id="auditStore" component-name="auditStore" interface="eu.unicorn.basse.ms.audit.api.store.AuditStore"/>
> <bean class="SomeBean"/>
> {code}
> *-> injecting reference info bean*
> {code:java}
> class SomeBean {
>    @BeanInject
>    AuditStore auditStore;
> }
> {code}
> From this point, I would expect that OSGI serves only one specific implementation of interface by specifying component-name attribute but it does not.
> As a workaround we managed to inject the reverence using setter or specifing name in @BeanInject annotation - *@BeanInject("auditStore")*
> I do not know if this is normal behaviour. Please, check this.
> Camel version 2.16.1



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)