Re: [S2] Accessing objects in the Spring context?

2009-09-10 Thread Marty Milligan
On Tue, Sep 8, 2009 at 6:54 PM, James Carr wrote: > Eh, that's the more complicated way... struts2 autowires by name, no > need to implement ApplicationContextAware. I didn't realize that. The code in SpringObjectFactory looks for ContextAware and sets it independently and then calls autowire.

RE: [S2] Accessing objects in the Spring context?

2009-09-09 Thread Mike Baranski
tember 08, 2009 10:11 PM >To: Struts Users Mailing List >Subject: Re: [S2] Accessing objects in the Spring context? > >I stand corrected. For some (unknown) reason I always thought that >interceptors and results where created by Class.forName(...) > >musachy > >On Tue, Sep

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread Musachy Barroso
I stand corrected. For some (unknown) reason I always thought that interceptors and results where created by Class.forName(...) musachy On Tue, Sep 8, 2009 at 6:37 PM, Musachy Barroso wrote: > nope. > > On Tue, Sep 8, 2009 at 6:32 PM, James Carr wrote: >> Couldn't I just make it ApplicationContex

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread Wes Wannemacher
On Tuesday 08 September 2009 09:32:19 pm James Carr wrote: > Couldn't I just make it ApplicationContextAware? > > On Tue, Sep 8, 2009 at 8:27 PM, Musachy Barroso wrote: > > WebApplicationContextUtils.getRequiredWebApplicationContext(ServletAction > >Context.getServletContext()); You *can* make it

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread Musachy Barroso
nope. On Tue, Sep 8, 2009 at 6:32 PM, James Carr wrote: > Couldn't I just make it ApplicationContextAware? > > On Tue, Sep 8, 2009 at 8:27 PM, Musachy Barroso wrote: >> WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext()); >> >> On Tue, Sep 8, 2009

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread James Carr
Couldn't I just make it ApplicationContextAware? On Tue, Sep 8, 2009 at 8:27 PM, Musachy Barroso wrote: > WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext()); > > On Tue, Sep 8, 2009 at 6:12 PM, James Carr wrote: >> I can try it out... how can I ma

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread Musachy Barroso
WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext()); On Tue, Sep 8, 2009 at 6:12 PM, James Carr wrote: > I can try it out... how can I make the bean factory available to my > interceptor? > > Thanks, > James > > On Tue, Sep 8, 2009 at 6:12 PM, Wes

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread James Carr
I can try it out... how can I make the bean factory available to my interceptor? Thanks, James On Tue, Sep 8, 2009 at 6:12 PM, Wes Wannemacher wrote: > I guess I sort of misunderstood your problem. Another approach would > be to retrieve the beans in an interceptor and push them onto the > value

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread Wes Wannemacher
I guess I sort of misunderstood your problem. Another approach would be to retrieve the beans in an interceptor and push them onto the value stack. As long as you give them a name they should be available from the view. This approach will keep you from changing any of the action code. If you want t

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread James Carr
Eh, that's the more complicated way... struts2 autowires by name, no need to implement ApplicationContextAware. I think people are missing the point. I got it working just fine by adding 10 properties to my action with appropriate getters and setters, but I'm trying to sneak around having to add t

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread Marty Milligan
On Tue, Sep 8, 2009 at 5:55 PM, James Carr wrote: > Yeah, I was looking for a way around it... these are simple hash maps > that are used to display select options. I wound up with an action > with 5 Maps in it :( If it were me, this is what I would do. First,use a Spring object factory in your S

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread James Carr
Yeah, I was looking for a way around it... these are simple hash maps that are used to display select options. I wound up with an action with 5 Maps in it :( Thanks, James On Tue, Sep 8, 2009 at 4:26 PM, Wes Wannemacher wrote: > You could use the @Autowire annotation directly on a property... But

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread Wes Wannemacher
You could use the @Autowire annotation directly on a property... But I don't really see how that is better than using setter-based injection. Just because the beans are singletons doesn't mean anything special, you still need a reference to them in your struts action. -Wes On Tue, Sep 8, 2009 at

Re: [S2] Accessing objects in the Spring context?

2009-09-08 Thread James Carr
I suppose I may use this: http://wiki.opensymphony.com/display/ABLE/Expose+Spring+Beans+in+JSP But I really wish/hope that struts2 has something built in. Thanks, James On Tue, Sep 8, 2009 at 4:13 PM, James Carr wrote: > I have several singleton based beans defined in my > applicationContext.xml