tags:

views:

32

answers:

1

I have a spring container running, and I have class with which I want to have access to the bean created inside spring container. The class I have is not registered with the spring container.

One thing I can do is that I can use MethodInvoker to call a static method, so I will have access to static field (this would be a bean from spring container) in my class always.

Do we have class like WebapplicationContextUtils for a application that is not web?

+2  A: 

You can implement ApplicationContextAware

Michał Mech
+1, but please provide links to newer version of the libraries.
Bozho
Sorry. I didn't notice that this was old version. Here is newest: http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/context/ApplicationContextAware.html
Michał Mech
I can't do this actually. Because the bean I am talking about is not registered with Spring container.I am looking forward to using a factory class which would give me access to spring container with some static method.
Antony