Yes avoid ComponentContext.inject() at all costs.  It is really bad.
The problem with ComponentContext.inject(), besides that it is a bad
programming pattern, is that it doesn't know which spring context you
are in.  So ComponentContext.inject() will inject only beans that are
defined in the "core" context.  So extensions are in a child of "core"
so it will not find beans in the child.  There are some ways to work
around this because API commands heavily rely on
ComponentContext.inject(), but I'd prefer that that not be used.
Basically, just don't use ComponentContext.inject().

This was also why at some point I mentioned that
List<SnapshotStrategy> can not be inject to a SnapshotObject.  The
SnapshotObject is setup with ComponentContext.inject() which will not
find the SnapshotStrategys because no SnapshotStrategys exist in the
"core" context.

I will have to work with Edison to eventually remove
ComponentContext.inject() from storage in general.

Darren

On Thu, Oct 24, 2013 at 1:40 PM, SuichII, Christopher
<chris.su...@netapp.com> wrote:
> So, I kind of figured it out…
>
> In the past, I was creating my DataStoreLifeCycle with 
> ComponentContext.inject() and it had some members which were @Injecte(d) - 
> those were the guys that were failing to be instantiated. When I switched to 
> simply @Inject my DataStoreLifeCycle into my DataStoreProvider, everything 
> works fine.
>
> So, with this new system, is there some reason that using 
> ComponentContext.inject() would fail to load beans while @Inject would 
> succeed?
>
> -Chris
> --
> Chris Suich
> chris.su...@netapp.com
> NetApp Software Engineer
> Data Center Platforms – Cloud Solutions
> Citrix, Cisco & Red Hat
>
> On Oct 24, 2013, at 4:04 PM, SuichII, Christopher <chris.su...@netapp.com> 
> wrote:
>
>> Darren,
>>
>> I’m switching my plugin over to use the new modularized Spring stuff you 
>> just merged and there is something I’m still battling with. I have other 
>> beans that were previously instantiated before my DataStoreProvider which 
>> get injected into the provider, lifecycle, etc. So, those beans need to be 
>> instantiated before the DataStoreProvider. How can I ensure those beans are 
>> created and setup before the DataStoreProvider does?
>>
>> -Chris
>> --
>> Chris Suich
>> chris.su...@netapp.com
>> NetApp Software Engineer
>> Data Center Platforms – Cloud Solutions
>> Citrix, Cisco & Red Hat
>>
>

Reply via email to