I get acquainted with Spring OSGI and Blueprint, but I have difficulties with the "classpath" (for example, many newbies).
I have two OSGI packages - one that defines different beans (using Blueprint, not what it matters) and exports them as services; and another bundle that references the beans service (using Spring OSGI) and connects them to some Apache Camel routes.
The service-provider blueprint component looks something like this:
<service id="camelTsvDataFormat" interface="org.apache.camel.spi.DataFormat"> <bean class="org.apache.camel.component.flatpack.FlatpackDataFormat"/> </service>
The Spring context of the consumer service package looks something like this:
<osgi:reference id="tsvDataFormat" interface="org.apache.camel.spi.DataFormat" /> <camel:camelContext> <route> <from uri="vm:in"> <setBody> <constant>SELECT * FROM myTable</constant> </setBody> <to uri="jdbc:myDataSource" /> <marshal ref="tsvDataFormat" /> <to uri="file:/path/to/my/files/?fileName=out.tsv" /> </route> </camel:camelContext>
... But after deploying Spring, "Unable to find class [org.apache.camel.spi.DataFormat]". I can add the interface to the Import Package section of my Bnd instructions, but it seems like Iβll have to manually list the class twice in different places once again.
An alternative choice is to extend the interface in my own project, so Bnd will automatically pick it up, but this is about the same amount of problems.
I assume that I expect Spring to look for services by interface name without actually resolving the interface class. Is it na & iuml; ve? Or is there a way for Bnd to automatically import interfaces into my appContext service links? If Bnd can do this (using plugins for example), is there a standard way to use Bnd plugins with the Apache Felix plugin for Maven?
source share