Hi, no it's not possible, it's two different containers.
However, you can expose a bean as a service in blueprint: <service interface="..."/> and use this service in Spring using spring-dm: <osgix:reference id="..." interface="..."/> Regards JB On 09/01/2014 10:00 AM, jimmy wrote:
Hi, Is it possible to reference to blueprint bean in a spring context. The idea is to use blueprint configuration properties and use it for my datasource in spring context. In my context.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:kie="http://drools.org/schema/kie-spring" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd"> <bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="<b>jbpm-ds*"/> <property name="persistenceUnitName" value="org.jbpm.persistence.jpa.local"/> </bean> </beans> in my blueprint.xml <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"> <cm:property-placeholder id="databaseProperties" persistent-id="datasourceJbpm" update-strategy="reload"> <cm:default-properties> <cm:property name="url" value="jdbc:mysql:loadbalance://xxxx:3306,yyyy:3306,eeee:3306/jbpm"/> <cm:property name="jndiName" value="jdbc/mysqlds"/> <cm:property name="driverClassName" value="com.mysql.jdbc.Driver"/> <cm:property name="username" value="root"/> <cm:property name="password" value=""/> <cm:property name="maxActive" value="200"/> </cm:default-properties> </cm:property-placeholder> <bean id=<b>"jbpm-ds"* class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="url" value="${url}"/> <property name="driverClassName" value="${driverClassName}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> <property name="maxActive" value="${maxActive}"/> </bean> </blueprint> gives the error Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'jbpm-ds' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:570) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1108) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springfr... -- View this message in context: http://karaf.922171.n3.nabble.com/Spring-Blueprint-bean-reference-sharing-tp4035006.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
