Good point, I haven't really tested this part specifically.
I've used the spring deployer to deploy my test xml in karaf, so afaik, it
uses a dynamicimport-package=*, so I'm not sure about the exact behaviour
yet.
In all cases, I think we should be able to solve that problem, because the
spring application context will actually create the spring beans, so we do
have control over the class loader here.  It should be possible to inject a
class loader what will be able to delegate to the blueprint bundle class
loader and to the various spring namespace bundles, so that importing the
packages should not be necessary.
I'll try to create an integration test to verify that.

Guillaume

2015-11-23 10:19 GMT+01:00 Christian Schneider <[email protected]>:

> I would not have thought that it is possible to combine Aries Blueprint
> and spring namespaces.
> All the better that it seems to work :-)
>
> How do you solve the classloader problem? Does the blueprint approach
> still have the same issues as spring dm? So does the user still
> have to make sure all internals the namespace needs are imported?
>
> Christian
>
>
>
> On 20.11.2015 17:56, Guillaume Nodet wrote:
>
>> I've just committed a new module (and the additional required changes and
>> existing modules) to support Spring namespaces (default and custom) in
>> blueprint.
>> See the source code at
>>
>>
>> http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-spring/src/main/java/org/apache/aries/blueprint/spring/
>>
>> It's limited and not much tested for now, but it can handle things like
>> the
>> following:
>>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>    xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>>    xmlns:bean="http://camel.apache.org/schema/blueprint";
>>    xmlns:util="http://www.springframework.org/schema/util";
>>             xsi:schemaLocation="
>>               http://www.osgi.org/xmlns/blueprint/v1.0.0
>> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>>               http://camel.apache.org/schema/blueprint
>> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>>               http://www.springframework.org/schema/tx
>> http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
>>               http://www.springframework.org/schema/util
>> http://www.springframework.org/schema/util/spring-util-4.2.xsd
>>               http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-4.2.xsd";>
>>
>>      <!-- plain blueprint bean referencing a spring bean -->
>>      <bean id="artemis"
>> class="org.apache.camel.component.jms.JmsComponent">
>> <property name="connectionFactory" ref="jmsConnectionFactory"/>
>>      </bean>
>>
>>      <!-- spring bean -->
>>      <bean name="jmsConnectionFactory"
>> class="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
>> factory-method="createConnectionFactory" xmlns="
>> http://www.springframework.org/schema/beans";>
>> <constructor-arg value="tcp://0.0.0.0:61616?user=karaf&amp;password=karaf
>> "/>
>> <constructor-arg value="broker"/>
>>      </bean>
>>
>>      <!-- spring bean using custom namespace, referencing spring and
>> blueprint beans -->
>>      <util:list id="springList" xmlns="
>> http://www.springframework.org/schema/beans";>
>> <value>foo</value>
>> <ref bean="jmsConnectionFactory" />
>> <ref bean="artemis"/>
>>      </util:list>
>>
>>      <!-- blueprint service referencing a spring bean -->
>>      <service ref="springList" auto-export="all-classes"/>
>>
>> </blueprint>
>>
>>
>> So you can use the default spring namespace or custom spring namespaces
>> and
>> cross-reference beans between blueprint and spring.
>>
>> I haven't tried auto-wiring or any advanced usage such as AOP.
>>
>> I'll try to commit a few initial integration tests beginning of next week.
>> Please have a look and provide feedback and additional use cases (as tests
>> ?).
>>
>> Cheers,
>> Guillaume Nodet
>>
>>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>

Reply via email to