This may help

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CC4QtwIwAQ&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DqTS7xJYfA-M&ei=FUIQT-vCAafl0QGM47C6Aw&usg=AFQjCNEL5IjcpYvt3TE0VQqjq86ifnMWlg&sig2=rhGX8XkyXYcVWe7Y2fMIXA


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of George Niculae
Sent: Friday, January 13, 2012 8:04 AM
To: sipXecs developer discussions
Subject: Re: [sipx-dev] Circular references in spring files

On Fri, Jan 13, 2012 at 3:00 PM, Douglas Hubler <[email protected]> wrote:
> On Fri, Jan 13, 2012 at 7:53 AM, Mircea Carasel <[email protected]> wrote:
>>
>>
>> On Fri, Jan 13, 2012 at 12:14 PM, Douglas Hubler <[email protected]> wrote:
>>>
>>> Someone discovered using lookup functions was a way to avoid
>>> circular references
>>>
>>> <bean a>
>>>  <bean b>
>>> </bean>
>>>
>>> <bean b>
>>>  <lookup bean a>
>>> </bean>
>>>
>>> The problem with this is that bean b needs to be abstract so spring
>>> can inject the method.  Abstract classes do not warn you when a
>>> class has not implemented a particular interface fully which is an
>>> incredibly valuable thing to know, especially in refactoring
>>> projects as I discovered.
>>>
>>> In every case I analyzed the circular dependency and easily avoid
>>> the issue by shuffling code around.  In each case, the final
>>> implementation was more cohesive, and overall more clear.
>>>
>>> Another use of lookup functions is to instantiate prototype beans
>>> (as opposed to singleton beans). I admit this *is* a legitimate use
>>> of this spring feature however I found that the issue with abstract
>>> classes I mentioned earlier to be so great it's not worth using
>>> lookup functions IMO.  Instead, simply keeping a reference to the
>>> bean factory and calling beanFactory.getBean to be fairly simple
>>> workaround however primitive it is.
>>
>> I think that another good way is to make one of the beans to
>> implement ApplicationContextAware interface and then to look up for
>> the bean you want using ApplicationContext.getBean. I recall that are
>> many examples  across the project that make use of this Spring
>> technique
>
> I think it's BeanFactoryAware.  If so, yes, we're talking about the
> same thing.  ApplicationContextAware is for catching spring events.

Same thing, ApplicationContext it's a BeanFactory 
_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev/

This message and any files transmitted with it are intended only for the 
individual(s) or entity named. If you are not the intended individual(s) or 
entity named you are hereby notified that any disclosure, copying, distribution 
or reliance upon its contents is strictly prohibited. If you have received this 
in error, please notify the sender, delete the original, and destroy all 
copies. Email transmissions cannot be guaranteed to be secure or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. Garrett County Government therefore does not 
accept any liability for any errors or omissions in the contents of this 
message, which arise as a result of email transmission.


 Garrett County Government,
203 South Fourth Street, Courthouse, Oakland, Maryland 21550 
www.garrettcounty.org
_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev/

Reply via email to