|
From: Rob B. <cro...@ya...> - 2005-09-27 23:08:58
|
Excellent!
Thank you.
Rob
--- Juergen Hoeller <ju...@in...> wrote:
> Actually, if you define two different
> implementations as lazy-init="true",
> including all beans that they depend on, you will
> only actually instantiate
> the beans that you explicitly refer to. If you have
> a placeholder a la <ref
> bean="${myTarget}"/>, only the actually referenced
> target bean and its
> dependencies will get instantiated.
>
> See the LobHandler definitions in our Image Database
> sample application for
> an example: The lazy-init flags there avoid to
> instantiate OracleLobHandler
> unless it is actually referenced by the DAO. That
> reference is expressed
> using a placeholder, so the actual choice can be
> driven by a properties
> file.
>
> If such lazy initialization becomes common in your
> bean definition file,
> consider setting default-lazy-init="true" at the
> <beans> level, only
> selectively turning off the lazy-init flag for
> specific beans that you want
> to have eagerly instantiated at startup.
>
> Juergen
>
>
> -----Original Message-----
> From:
>
spr...@li...
>
[mailto:spr...@li...]
> On Behalf Of
> Rob Butler
> Sent: Saturday, September 24, 2005 4:32 AM
> To: spr...@li...
> Subject: [Springframework-developer] Conditional
> configuration
>
> Hey all,
>
> I was wondering if Spring could be enhanced to
> support "conditional
> configuration" or if there is a way to do this
> already that I haven't
> thought of.
>
> Let's say your app has a property file bean post
> processor. Depending upon
> a setting in the property file you want to switch
> between two different
> implementations of some interface - Impl1 & Impl2.
> No problem, Spring does
> this easily.
>
> But let's say those two different implementations
> also have a number of
> Spring managed beans injected into them. So if your
> using Impl2 then all
> the Spring managed beans that are injected into
> Impl1 aren't needed.
>
> Is there a way to have spring _not_ instatiate and
> configure some beans
> depending upon a value obtained from a bean post
> processor?
>
> If this doesn't already exit perhaps a new attribute
> can be added to the
> bean tag like "load" or "configure". If load="true"
> then the bean is
> loaded.
> In this way Impl1 could be keyed to
> load="${useImpl1}"
> and so could all of the Spring managed beans that
> would be injected into it.
> Thus, if useImpl1 was false Impl1 and all the
> objects constructed to support
> it would never be instantiated.
>
> It would also be preferable for references to bean
> post processor values
> that used in un-instantiated objects to no longer be
> necessary. I.E. if
> Impl1 has someSetter="${someProperty}" and Impl1
> load="false"
> then spring should not error if "someProperty" is
> not provided.
>
> Thoughts?
>
> Rob
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
>
>
-------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's
> Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv
> or your very own
> Sony(tm)PSP. Click here to play:
> http://sourceforge.net/geronimo.php
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
>
https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
>
>
>
-------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's
> Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv
> or your very own
> Sony(tm)PSP. Click here to play:
> http://sourceforge.net/geronimo.php
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
>
https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|