Timo,
I'm not a spring expert, so I set out to the trusty google... following article looked fairly promising...
http://www.devx.com/Java/Article/21665
Had some examples of using XmlBeanFactory to get at the info (apparently not really recommended, though),
discussion of setter/constructor dependency injection, etc. Page 3 of the article looked especially promising.
Robert Tim Colson wrote:
So I've found some info on getting the Spring Context inside a generic servlet.
ServletContext servletContext = this.getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(servletContext);
But where I need to get the context is inside a class that is a Servlet Filter... which does not have access to a servlet context (presumably because filters can act cross contexts?)
So I'm still stuck. :-(
Timo
-----Original Message-----
From: Tim Colson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 23, 2004 1:32 PM
To: [EMAIL PROTECTED]
Subject: [jug-discussion] How to grab a Spring configured bean?
Hey folks -
I'm trying to understand and use Spring, falling down a bit.
I have a "ds" bean in Spring config (DataSource), and a Struts action which
extends DispatchActionSupport. It is easy to grab the bean using:
getWebApplicationContext().getBean("ds");
Cool.... but now I am in another class which is not an action -- and I'm at
a loss how to grab the "ds" bean. :-(
I'm reading the 200 pages of docs ...but if anybody could point me to the
relevant bit to jump-start me, that'd be great!
Timo
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]