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?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
user896805
  • 241
  • 3
  • 9

2 Answers2

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

user896805
  • 241
  • 3
  • 9
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.

Emil Lundberg
  • 7,268
  • 6
  • 37
  • 53