|
From: Ross M. <ro...@at...> - 2003-12-16 02:39:03
|
Ok mate, sounds like it's time for you to hit the sack. BTW What's the book? you can tell me in the morning ;-) Cheers, Ross j=FCrgen h=F6ller [werk3AT] wrote: > I could have thought of that if it wasn't already so late (3:20 in the = morning now). Yes, that's a known limitation: If you proxy an object, bot= h the proxy and the target object will match the type. You need to resort= to explicit references for such beans - as I said, this will even work f= or specific references if you apply autowire-by-type in general. > =20 > BTW, have I mentioned that writing a book is *damn hard work*? ;-) > =20 > Juergen > =20 >=20 > ________________________________ >=20 > Von: spr...@li... im Auftrag v= on Ross Mason > Gesendet: Di 16.12.2003 02:23 > An: spr...@li... > Betreff: Re: [Springframework-developer] Refreshing the ApplicationCont= ext... >=20 >=20 >=20 > Hi j=FCrgen, >=20 > When I run getBeansOfType() on our config (turning off autowireByType) = I > do get two beans returned: > - I get the emialTemplateManager as expected (this is a proxy > org.springframework.transaction.interceptor.TransactionProxyFactoryBean= ). > - I also get back our emailTemplateManagerTarget which is our proxied > object. >=20 > This suggests you can't use autowireByType when using > TransactionProxyFactoryBean or any other ProxyFactoryBean. Is this > intended behaviour? >=20 > Cheers, >=20 > Ross >=20 >=20 > j=FCrgen h=F6ller [werk3AT] wrote: >=20 >=20 >>Ross, >> >>If you build a single context from multiple files, autowiring will auto= matically scan all the bean definitions in those files. In your case, I a= ssume that you do have multiple definitions of type EmailTemplateManager,= possibly in two different context files. You could check that programmat= ically by examining the result of ApplicationContext.getBeansOfType(Email= TemplateManager.class, true, true). >> >>In any case, even if you apply autowiring in general, you can always ov= erride a specific dependency, like an explicit bean reference from proper= ty "emailTemplateManager" of bean "notifierCreatePage" to a specific bean= of type EmailTemplateManager: >> >><bean id=3D"notifierCreatePage" class=3D"..." autowire=3D"byType"> >> <property name=3D"emailTemplateManager"><ref bean=3D"myEmailTemplateM= anager"/></property> >> ... >></bean> >> >>Juergen >> >> >>________________________________ >> >>Von: spr...@li... im Auftrag v= on Ross Mason >>Gesendet: Di 16.12.2003 01:00 >>An: spr...@li... >>Betreff: Re: [Springframework-developer] Refreshing the ApplicationCont= ext... >> >> >> >>Hi j=FCrgen, >> >>We were using refresh as we needed to defer the initialisation of the >>String container the first time our app is run until the user has setup >>their db settings, at which point we initialise the container. After >>that, if/when the server is restarted we use your ContextLoaderListener >>is used to initialise the container. >> >>I think I've just realised what the problem is. We have 3 >>applicationContexts and the bean causing the error is defined in a >>different context. Is there a way to autowire over multiple contexts? >> >>If this is the case, the exception for this scenario is a bit misleadin= g >>as it tells me there is more than one satifiable dependency. >> >>The exception we get is - >>org.springframework.beans.FatalBeanException: Can't resolve reference t= o >>bean 'notifierCreatePage' while setting property 'listeners[0]' on bean >>'producerCreatePage'; nested exception is: >>org.springframework.beans.factory.UnsatisfiedDependencyException: Bean >>with name 'notifierCreatePage' has an unsatisfied dependency expressed >>through property 'emailTemplateManager': set this property value or >>disable dependency checking for this bean; detail message =3D [There ar= e 2 >>beans of type [interface >>com.atlassian.confluence.mail.template.EmailTemplateManager] for >>autowire by type. There should have been 1 to be able to autowire >>property 'emailTemplateManager' of bean 'notifierCreatePage'.] >>(This is very informative excetion BTW ;-)) >> >>Cheers, >> >>Ross >> >> >>j=FCrgen h=F6ller [werk3AT] wrote: >> >> >> >>>Hi Ross, >>> >>>"refresh" is now in ConfigurableApplicationContext, but you shouldn't = need that for typical usages anyway. I guess what you're trying to do is = custom initialization of the root WebApplicationContext, storing it in a = custom place via the setApplicationContext call. That should be fine: I s= uppose that the error you're getting has other origins. Autowiring has be= en significantly reworked; could you check for which components you get m= ore than one matching bean? The reason could be that you actually *have* = multiple matching beans, which just weren't found by M2's autowire implem= entation, maybe due to being created by FactoryBeans. Could you quote rel= evant parts of your configuration? >>> >>>Juergen >>> >>> >>>________________________________ >>> >>>Von: spr...@li... im Auftrag = von Ross Mason >>>Gesendet: Mo 15.12.2003 07:50 >>>An: spr...@li... >>>Betreff: [Springframework-developer] Refreshing the ApplicationContext= ... >>> >>> >>> >>>Hi, >>> >>>In the latest source the ApplicationContext.refresh() method has been >>>removed. What is the recommended way of refreshing an >>>applicationContext now. I'm trying - >>> >>> ContextLoader loader =3D new ContextLoader(); >>> setApplicationContext( >>>loader.initWebApplicationContext(servletContext) ); >>> >>>But I am getting an error saying that there is more than one matching >>>bean on some components when autoWiring by type. Our code and cofig >>>works fine with M2 release, but we're mored to the latest source to ma= ke >>>use of the OpenSessionInViewFilter. >>> >>>Any ideas? >>> >>> >>>Cheers, >>> >>>Ross >>> >>> >>> >>>------------------------------------------------------- >>>This SF.net email is sponsored by: IBM Linux Tutorials. >>>Become an expert in LINUX or just sharpen your skills. Sign up for IB= M's >>>Free Linux Tutorials. Learn everything from the bash shell to sys adm= in. >>>Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclic= k >>>_______________________________________________ >>>Springframework-developer mailing list >>>Spr...@li... >>>https://lists.sourceforge.net/lists/listinfo/springframework-developer >>> >>> >>> >>> >>>------------------------------------------------------- >>>This SF.net email is sponsored by: IBM Linux Tutorials. >>>Become an expert in LINUX or just sharpen your skills. Sign up for IB= M's >>>Free Linux Tutorials. Learn everything from the bash shell to sys adm= in. >>>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id371&op=CCk >>>_______________________________________________ >>>Springframework-developer mailing list >>>Spr...@li... >>>https://lists.sourceforge.net/lists/listinfo/springframework-developer >>> >> >> >> >> >>------------------------------------------------------- >>This SF.net email is sponsored by: IBM Linux Tutorials. >>Become an expert in LINUX or just sharpen your skills. Sign up for IBM= 's >>Free Linux Tutorials. Learn everything from the bash shell to sys admi= n. >>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id371&op=3Dick >>_______________________________________________ >>Springframework-developer mailing list >>Spr...@li... >>https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> >> >> >>------------------------------------------------------- >>This SF.net email is sponsored by: IBM Linux Tutorials. >>Become an expert in LINUX or just sharpen your skills. Sign up for IBM= 's >>Free Linux Tutorials. Learn everything from the bash shell to sys admi= n. >>Click now! http://ads.osdn.com/?ad_id=1278&alloc_id371&op=CCk >>_______________________________________________ >>Springframework-developer mailing list >>Spr...@li... >>https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM= 's > Free Linux Tutorials. Learn everything from the bash shell to sys admi= n. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id371&op=3Dick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM= 's > Free Linux Tutorials. Learn everything from the bash shell to sys admi= n. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id371&op=CCk > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer >=20 |