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]

Reply via email to