RE: [S2] How to get an object from Spring inside an interceptor

2007-05-23 Thread Fowler, Perryn
If you use the Spring plugin, you should be able to have your actions and your interceptors created by Spring. Then you can simply configure Spring to create your interceptor already wired up with a SessionFactory. -Original Message- From: Célio Cidral Junior [mailto:[EMAIL PROTECTED]

Re: [S2] How to get an object from Spring inside an interceptor

2007-05-23 Thread Célio Cidral Junior
2007/5/23, Guillaume Carré <[EMAIL PROTECTED]>: if your SessionFactory is injected in your action, and all your actions extend "AbstractAction" for example, that has a getSessionFactory() method, you can do this: public String intercept(ActionInvocation invocation) throws Exception { Action

Re: [S2] How to get an object from Spring inside an interceptor

2007-05-23 Thread Guillaume Carré
2007/5/23, Célio Cidral Junior <[EMAIL PROTECTED]>: Hi, I want to implement an OpenInView pattern interceptor involving Hibernate, but there's a problem. My SessionFactory is both created and managed by Spring, and my interceptor should have access to that SessionFactory, however I don't know ho

Re: [S2] How to get an object from Spring inside an interceptor

2007-05-23 Thread Josh Vickery
Not the most elegant solution, but you can pull the ApplicationContext from the ServletContext: ServletContext sc = ServletActionContext.getServletContext(); (ApplicationContext)sc.getAttribute("org.springframework.web.context.WebApplicationContext.ROOT"); Josh On 5/23/07, Célio Cidral Junior <