[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Non-distributed bean references in domain objects  XML
Forum Index -> Terracotta for Spring
Author Message
anodos

journeyman

Joined: 12/11/2006 13:33:29
Messages: 41
Offline

I have some distributed domain objects that hold onto references of Spring beans that are not distributed. The lifecycle of these domain objects is not managed by Spring, so I cannot use the very nifty <non-distributed-field> tag (which, if I understand correctly, automatically injects the VM local bean being referenced on each VM). This leaves me to declare the field as transient. However, how do I then inject a reference of the VM local bean into this domain object? I would like to do something like this in the on-load beanshell:
Code:
self.aclAuthStrategy = context.getBean("aclAuthStrategy")

Does the Spring module happen to provide access to the ApplicationContext to the beanshell onload? Since these are domain objects, they do not themselves have any reference to the ApplicationContext.
ekulesho

master

Joined: 12/04/2006 08:49:08
Messages: 57
Offline

I couldn't think of any way to get instance of the Spring application context. Since your distributed bean is not managed by Spring, it can be faulted in anywhere in the code and we don't have any control n its life cycle. So, we can only handle local dependencies for you if distributed instance is accessed trough Spring's context.

For the on-load script, the only way to get your hand on application context is to use some static factory to access Spring context. I don't remember if Spring provides any helper classes for retrieving application context in web in case of the web application.
[WWW]
 
Forum Index -> Terracotta for Spring
Go to:   
Powered by JForum 2.1.7 © JForum Team