how to import osgi blueprint xml
Asked Answered
K

2

8

I am trying to import an OSGI blueprint XML file in to another OSGi blueprint XML file.

e.g.: blueprint1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint ....>
    <bean id="myBean1" class="com.company.Class1"/>
    <bean id="myBean2" class="com.company.Class2"/>
</blueprint>
</xml>

blueprint2.xml:

<?xml version="1.0" encoding="UTF-8"?>
<blueprint ....>
    <!-- DOES NOT WORK -->
    <import resource="blueprint1.xml" />
</blueprint>

The <import> works for spring but not for blueprint.

Does anybody know a way of doing this in OSGi blueprint XML files?

Krummhorn answered 6/8, 2012 at 10:48 Comment(0)
K
10

Apparently, Spring like imports are not currently possible in blueprint.

However, if the files are in the same OSGi bundle then they are in the same context and can be used from other blueprint files.

Also, see here: http://fusesource.com/forums/message.jspa?messageID=15091#15091

Krummhorn answered 9/8, 2012 at 7:5 Comment(0)
A
0

If you're using Gemini Blueprint (formerly Spring DM) you can simply tell it to load both files, and basically treat them as if they were one big file:

In the absence of the Spring-Context header the extender expects every ".xml" file in the META-INF/spring folder to be a valid Spring configuration file [...].

It also treats any xml files in /OSGI-INF in the same way.

Alexi answered 4/7, 2013 at 12:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.