isnt a big point of osgi to manage cross-bundle-dependencies? so if you inject panel A using panel A's context how does panel A ever see beans that are defined in module B?
eg if panel A needs a sessionfactory which is defined in module B? -igor On Tue, Jun 23, 2009 at 5:36 AM, Daniel Stoch<[email protected]> wrote: > Hi, > > I think your problem is that in Wicket the whole Spring injection > mechanism is prepared for applications where there is only one > ApplicationContext (AC). This AC is hold in the Wicket application > instance. So when you are trying to use @SpringBean annotation Wicket > tries to inject a bean from this AC. > Inside OSGi there are many AC (each bundle has its own AC), so the > base Wicket injection mechanism does not work here for all ACs, only > for one which you are save in Wicket application instance. The best > solution here is to make adaptation of Wicket injection mechanism to > OSGi environment (as we did in our application platform). It is not so > easy, but it can be done :). > > It can work as follows (short draft): > When you are using @SpringBean to inject bean inside a class PanelA > then injection mechanism should injects a bean from ApplicationContext > of bundle where class PanelA is defined. So you must store somewhere > information about ApplicationContext in context of bundle class > loader. Then when you injecting a bean to PanelA: get a class PanelA > classloader find a proper AC for it and then inject a bean from this > AC. > > -- > Daniel > > On Tue, Jun 23, 2009 at 10:05 AM, Daniel Dominik > Holúbek<[email protected]> wrote: >> Okay, but I still don't understand the reason of doing this stuff :)I've >> already created the Application bean, and implemented >> ApplicationContextAware. >> Then the setApplicationContext method gets called, so I created >> ApplictionContext variable in that class and set it it that method. >> But if I try to access it in another bundle via Application.get(), it is >> still "null". >> But even if it wasn't, I think that the DAO bean, declared in other bundle >> (database-bundle) would not be there. >> >> Just to make it clear - we've got three bundles. The database bundle has >> everything needed to operate with DB. It creates DAO beans and makes OSGi >> sevices from them. Then, there is an Application bundle. And the last bundle >> is Panel bundle, which is loaded into the App bundle via an extension point. >> I need to access the DAO in the Panel bundle, and there comes the problem >> mentioned above. >> >> That's why I do not understand why should I change the Application bundle >> (except the Panel complaining about Application not being in Spring Extender >> thread). >> >> Thanks for your help :) >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
