I think what you want to do is achievable if you have some custom code to search through all the bundles imported and get the springA.xml and add it to your application context.
I see that you are using Spring-DM, so in that case, if you are relying on the extender, why not expose your bundle A beans as services and then reference them from bundle B,C,D, etc. On Wed, Mar 30, 2011 at 5:37 AM, Daniele Dellafiore <[email protected]>wrote: > On Wed, Mar 30, 2011 at 2:23 PM, Daniele Dellafiore > <[email protected]>wrote: > > > Hi have bundle A with a springA.xml file that depends on beans from > bundle > > B springB.xml > > I've added a springA-osgi.xml with declared services and on bundle A > > activation everything works and I have > > > > > > | INFO | tenderThread-114 | OsgiServiceFactoryBean | > > r.support.OsgiServiceFactoryBean 301 | 42 - > org.springframework.osgi.core - > > 1.2.0 | Publishing service under classes > > [{in.laz.storage.mongo.StorageTemplate}] > > INFO | tenderThread-114 | OsgiServiceFactoryBean | > > r.support.OsgiServiceFactoryBean 301 | 42 - > org.springframework.osgi.core - > > 1.2.0 | Publishing service under classes [{com.mongodb.Mongo}] > > > > both of them (even if I really need to export the first as service, being > > the second injected in the first, anyway. > > > > Then bundleB have a StorageTemplate (first service) autowired into a > bean. > > That does not work: > > "No matching bean of type [in.laz.storage.mongo.StorageTemplate] found > for > > dependency" > > > > even if in springB,xml I import both springA and springA-osgi xml (which > I > > thiink should not be necessary). > > > > Two question here: > > 1. What am I possibly missing that's not making it work? > > 2. I'd like that every bundle that imports springA.xml create some new > > instances of the beans defined there, but I do not think that's what is > > happening: I thing that bundle A instance the beans and export them as > > services, and the same instance is eventually injected into the beans of > > bundle B. That's not what I want, I just want the spring beans definition > to > > stay in bundle A so I do not have to duplicate it in every other bundle, > how > > can I achieve that? > > > > sorry I sent it before was completed. > So basically I am failing doing a thing that's not what i really need to > do, > I just realised :) > > But I am not finding a way to just make a bundle read xml files from other > bundles, that should be supported, isn't it? I expect it to be even easier > than autowiring spring beans exported as osgi services, but if xml are not > exported... that won't work at all. > > Thanks for any hint. >

