Can you have your Application object created as a Spring bean and make it context "aware" and let the container inject the context into it?
On Mon, Jun 22, 2009 at 2:02 AM, Daniel Dominik Holúbek<[email protected]> wrote: > But as far as I understand this, Spring DM is built upon the idea that I > can't build ApplicationContext, as it is built by Spring DM Extender. Am I > right? > > On Mon, Jun 22, 2009 at 12:37 AM, James Carman <[email protected] >> wrote: > >> Try using the other SpringComponentInjector constructor (the one that >> takes an ApplicationContext object). Construct your >> ApplicationContext however you want. >> >> On Sun, Jun 21, 2009 at 2:09 PM, Daniel Dominik Holúbek >> <[email protected]> wrote: >> > >> > Well, no.I'll explain: >> > It's an OSGi app running in equinox-bridge. In my bundles there is no >> > web.xml, and that's why I can't configure ContextLoaderListener. >> > And because of this, when i add @SpringBean into my code, then add >> > "addComponentInstantiationListener(new SpringComponentInjector(this))" >> into >> > WebApplication's init method and then run the application, the only thing >> I >> > get is this exception: java.lang.IllegalStateException: No >> > WebApplicationContext found: no ContextLoaderListener registered? >> > >> > But if there is a way how to set up that listener, I would be happy :) >> > >> > >> > On Sun, Jun 21, 2009 at 7:28 PM, James Carman >> > <[email protected]>wrote: >> > >> > > You can't use @SpringBean? >> > > >> > > On Sun, Jun 21, 2009 at 11:03 AM, Daniel Dominik >> > > Holúbek<[email protected]> wrote: >> > > > Hello everyone :)So, I solved the Spring DM problems successfully... >> but >> > > > there is still one problem left, and this time I am absolutely sure >> that >> > > > it's a Wicket related problem :) >> > > > >> > > > I want to inject my "userDao" bean into Panel class. To do that, I >> nead >> > > to >> > > > create a bean from that Panel class - like this: >> > > > >> > > > >> > > > <bean name="consumer" >> class="sk.ziwhat.megaweb.loginpanels.prvy.lPanel" >> > > > init-method="init"> >> > > > >> > > > <property name="userDao" ref="userDao" /> >> > > > >> > > > </bean> >> > > > But when I try this, I get an exception: >> > > > >> > > > Caused by: org.apache.wicket.WicketRuntimeException: There is no >> > > application >> > > > attached to current thread SpringOsgiExtenderThread-4 >> > > > This happens when Spring is trying to instantiate the Panel class. >> > > > >> > > > I tried this with ordinary class and everything worked fine. The idea >> was >> > > > that I will instantiate a normal class, and then I will access it >> from >> > > the >> > > > Panel class, but when I do: >> > > > >> > > > ServiceConsumer sc = new ServiceConsumer(); >> > > > >> > > > and then access userDao, I'll get a NullPointerException of course. >> > > > >> > > > So has anybody done this before? I think I need your help :) >> > > > >> > > > Thanks a lot! >> > > > >> > > > On Tue, Jun 16, 2009 at 2:01 AM, djo mos <[email protected]> >> wrote: >> > > > >> > > >> Hi, >> > > >> >> > > >> On Mon, Jun 15, 2009 at 9:28 PM, Daniel Dominik Holúbek < >> > > >> [email protected]> wrote: >> > > >> >> > > >> > Well, may be, but won't they send me back to this mailinglist? >> :)To be >> > > >> > honest, I have only a little problem with Spring DM itself (there >> are >> > > >> > couple >> > > >> > of tutorials out there), I was only curious about whether somebody >> has >> > > >> > successfully tried this. >> > > >> > For example, now it seems that the dependency is not being >> injected in >> > > my >> > > >> > code. And I can't do that via @SpringBean, because that needs to >> be >> > > set >> > > >> in >> > > >> > web.xml, and I have no web.xml in my OSGi bundle. >> > > >> >> > > >> >> > > >> Actually with Spring DM you do have web.xml in web bundles, as >> described >> > > in >> > > >> their reference documentation. >> > > >> I'v been able to use Wicket with Spring DM without problems. No >> > > Hibernate >> > > >> though : it really wasn't designed for a strictly controlled >> environment >> > > >> such as OSGi. >> > > >> >> > > >> So, I guess that your problem (not getting IoC to work) is not >> Wicket >> > > >> related but Spring DM related. >> > > >> >> > > >> Cheers >> > > >> >> > > >> > >> > > >> > >> > > >> > But yes, there is a chance that the problem has nothing to do with >> > > Wicket >> > > >> > itself. >> > > >> > >> > > >> > On Mon, Jun 15, 2009 at 4:38 PM, Igor Vaynberg < >> > > [email protected] >> > > >> > >wrote: >> > > >> > >> > > >> > > isnt this a question for the spring dmserver forum? >> > > >> > > >> > > >> > > -igor >> > > >> > > >> > > >> > > On Mon, Jun 15, 2009 at 3:49 AM, Daniel Dominik >> > > >> > > Holúbek<[email protected]> wrote: >> > > >> > > > Hello,has anybody here successfully used Spring DM with >> Hibernate >> > > >> (the >> > > >> > > OSGi >> > > >> > > > way) in Wicket? >> > > >> > > > I am totally hopeless about this... >> > > >> > > > >> > > >> > > > The goal is to create modular app with this features: >> > > >> > > > - every module (bundle) has its own applicationContext and DAO >> > > >> classes. >> > > >> > > > - i.e. if I have a module which loads blogs, I want to include >> the >> > > >> Blog >> > > >> > > > entity with corresponding DAO in the bundle and nowhere else. >> > > >> > > > >> > > >> > > > Thanks in advance. >> > > >> > > > >> > > >> > > > -- >> > > >> > > > -danoh- >> > > >> > > > >> > > >> > > >> > > >> > > >> > > --------------------------------------------------------------------- >> > > >> > > To unsubscribe, e-mail: [email protected] >> > > >> > > For additional commands, e-mail: [email protected] >> > > >> > > >> > > >> > > >> > > >> > >> > > >> > >> > > >> > -- >> > > >> > -danoh- >> > > >> > >> > > >> >> > > > >> > > > >> > > > >> > > > -- >> > > > -danoh- >> > > > >> > > >> > > --------------------------------------------------------------------- >> > > To unsubscribe, e-mail: [email protected] >> > > For additional commands, e-mail: [email protected] >> > > >> > > >> > >> > >> > -- >> > -danoh- >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > -- > -danoh- > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
