|
From: Juergen H. <ju...@in...> - 2006-06-21 21:13:34
|
Indeed... although I wonder why you passed in "false" as the last argument there in the first place. After all, the main reason to pass "false" in there was to avoid eager initialization of FactoryBeans... For a significant portion of typical Spring apps, this shouldn't make much difference (at least I hope so), since the intent of the original flag is still somewhat similar to the new semantics. Still, point taken - we need to clearly document this. It is a change in semantics for applications that either rely on default-lazy-init for all beans or make use of the getBeansOfType variant with "false" as last argument. Unfortunately, there was no other way to provide the desired behavior for lazy loading of bean classes. The main goal was to not have standard getBeansOfType calls trigger the loading of all bean classes defined in the context. Hope the migration was still smooth enough for you... Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf Of Matt Sgarlata Sent: Wednesday, June 21, 2006 11:02 PM To: spr...@li... Subject: Re: [Springframework-developer] Changed behavior fordefault-lazy-init="true" in 2.0 M5 This also changes the behavior of ListableBeanFactory.getBeansOfType(Class, boolean, false). In Spring 1.x this method would return beans that had lazy-init="true" but in Spring 2.x this method does not reutrn beans with lazy-init="true". This has been the largest source of migration headaches for me in my application. Matt Colin Sampaleanu wrote: > I think this makes sense, personally, although it does mean most apps > marked with the default lazy init set to true will probably have to > have their config tweaked. I guess we need to really emphasize this > change in the change docs. > > Colin > > On 6/18/2006 7:40 PM, Juergen Hoeller wrote: > >> This is actually expected behavior: lazy-init has stronger effect in >> Spring 2.0 now, not even loading the affected bean classes until they >> are explicitly accessed. >> >> For an application context's type detection (such as >> BeanFactoryPostProcessor detection or ApplicationListener detection), >> we only check beans that allow for eager initialization now (i.e. >> that are not marked as lazy-init and are not FactoryBeans). >> >> Else we'd have to load each and every bean class just to find out >> those special beans, which would require all bean classes to be >> present and loadable - and exactly that is what we intend to avoid >> with the new semantics in the first place. >> >> A further goodie enabled by lazy class loading for lazy-init beans is >> that a PropertyPlaceholderConfigurer can even resolve placeholders in >> bean class names now, at least for beans marked as lazy-init. >> >> So the recommended solution in case of default-lazy-init=true would >> be to explicitly mark all affected beans (the ones supposed to be >> autodetected) as lazy-init=false. >> >> Juergen >> >> >> -----Original Message----- >> From: spr...@li... >> [mailto:spr...@li...] On >> Behalf Of Claus Nordahl >> Sent: Sunday, June 11, 2006 2:26 AM >> To: spr...@li... >> Subject: [Springframework-developer] Changed behavior for >> default-lazy-init="true" in 2.0 M5 >> >> Hi all, >> >> When using default-lazy-init="true" with the 2.0 M5 release, I find >> that neither does my PropertyPlaceholderConfigurer's do its stuff nor >> does my ApplicationListener's receive any events as they all did with >> previous releases. >> >> Is this expected behavior? >> >> Regards, >> Claus Nordahl >> >> >> >> >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-develope >> r >> >> >> >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-develope >> r >> >> >> All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |