Migrating from spring-dm to aries blueprint

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Migrating from spring-dm to aries blueprint


Documentation on moving from spring-dm to aries is difficult to find. I took two different approaches that I would like to discuss/verify:

The first one using some hints I found on this forum regarding using:
- org.apache.aries.blueprint/org.apache.aries.blueprint.spring
- org.apache.aries.blueprint/org.apache.aries.blueprint.spring.extender

I simply changed Karaf's feature file:

<feature name="our-feature" version="1.0.0-SNAPSHOT" description="Our Feature">
        <feature version="3.1.4.RELEASE">spring</feature>
-       <feature version="1.2.1">spring-dm</feature>
+      <feature>aries-blueprint</feature>

+      <bundle>mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.spring/0.3.0</bundle>
+      <bundle>mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.spring.extender/0.3.0</bundle>

This appear's to work apart from some error messages:
[Error] blueprint-spring-extender5566039697982863264.xml:6:81: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'bean:import'.
Possibly due to the fact that we are using a lower spring version (3.1) that is declared (4.2) in the generated blueprint xml:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">
        <bean:import resource="bundle://66.0:0/META-INF/spring/base-context-osgi.xml"/>
        <bean:import resource="bundle://66.0:0/META-INF/spring/bundle-context-processing.xml"/>
        <bean:import resource="bundle://66.0:0/META-INF/spring/bundle-context.xml"/>
        <bean:import resource="bundle://66.0:0/META-INF/spring/server-context-integration.xml"/>

As i stated, apart from the error messages the bundles are all started and active. The only downside is that we are still using spring configuration. The spring-dm configuration files are separated from other spring wiring which brings me the second approach:

Migrate the spring-dm configuration files to blueprint configuration files (including location OSGI-INF/blueprint). Also converting spring properties to aries properties (https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Deploying_into_the_Container/files/DeployCamel-OsgiConfigProps.html).

The result is pure blueprint configuration files... at least for the definitions. We're left with references to non blueprint beans. Since we use spring batch and need those (spring) beans to be exposed as a service we need a mechanism to resolve those beans in a blueprint context.

I tried adding
- org.apache.aries.blueprint/org.apache.aries.blueprint.spring
- org.apache.aries.blueprint/org.apache.aries.blueprint.spring.extender
but this gave me not what I was hoping for.

I have not found any documentation on using these bundles and hopefully someone can provide me with some more information.