I solve this problem by introducing another spring's xml inside wicket's repository, which I didn't want to do this at first. (I was looking for a programmatic way , but it seems not so easy... )
2013/5/11 smallufo <[email protected]> > > > > 2013/5/11 Marco Springer <[email protected]> > >> Maybe this is too simple but: >> >> Did you define this bean in the applicationContext.xml?: >> <bean id="myobj" class="{impl. class}">{possible properties}</bean> >> >> > > No this is not what I want. > > The whole story is ... > I have two maven repositories : > > One is *business-layer* , which defines whole business objects , service > layers , and make use of SpringConfig and package scan to build a lot of > beans . > Another is *wicket-layer* , which depends on business-layer , and makes > use of beans scanned in the business-layer and serve the web. > > The problem is : > All the beans are defined ( package scanned ) in the business-layer. > There is no spring's xml or spring's @Repository class or SpringConfig > settings in the wicket-layer. > > But I have some idea of implementing some interface which depends on > wicket's library. > Such as getting absolute url of a DynamicImageReference or a > PackageResourceReference > , which depends on RequestCycle and wicket's components. > > I wonder how to programmatically generate such bean and inject to the > spring ? > > class MyApplication extends WebApplication { > @SpringBean dao; // defined in business-layer , and injected > successfully. > > public init () { > getComponentInstantiationListeners().add(new > SpringComponentInjector(this)); > Injector.get().inject(this); > > *URLGetter urlGetter = new URLGetterDynImgRefImpl(dao);* > // How to inject this "urlGetter" to spring ? > } > } > > In the above code , how to inject the "urlGetter" object to Spring ? so > that other wicket WebPage or Panel can use @SpringBean(name="urlGetter") to > get the object ? > > Thanks. > >
