You can "import" the Spring app context as spring. The way to share is by the service registry (it's the purpose !).

Regards
JB

On 05/06/2015 12:39 PM, panneerselvam wrote:
Hi,
Thanks it is working with the workaround as mentioned below,
while defining the bean and datasource reference inside Bundle B , *the
issue got resolved *<osgi:reference id="dataSource"
interface="javax.sql.DataSource" />
        <bean id="jdbcTemplate" 
class="org.springframework.jdbc.core.JdbcTemplate">
                <constructor-arg ref="dataSource" />
        </bean>

However i am expecting this to work by imoporting the appcontext.xml from
Bundle A inside Bundle B as mentioned below

I have two bundles A and B, in which Bundle A (appContext-dataSource.xml)
has the data source configuration

<osgi:reference id="dataSource"  interface="javax.sql.DataSource" />
        <bean id="jdbcTemplate" 
class="org.springframework.jdbc.core.JdbcTemplate">
                <constructor-arg ref="dataSource" />
        </bean>

I am importing the appContxt-A.xml to the Bundle B(appContext-B.xml) as *
<import resource="classpath*:appContext-dataSource.xml" />* and i am trying
to autowire jdbcTemplate in the one of the bean in Bundle B. In this
scenario i am getting No bean definition error.

Is it possible to import the appcontext.xml from one bundle to the other
bundle?







--
View this message in context: 
http://karaf.922171.n3.nabble.com/Spring-Blueprint-bean-reference-sharing-tp4035006p4040199.html
Sent from the Karaf - User mailing list archive at Nabble.com.


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to