You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ravi_116 <ra...@gmail.com> on 2007/12/14 00:57:50 UTC
Using Spring beans with session scope
I am a newbie to wicket. Our wicket application is integrated with Spring
using the SpringComponentInjector. Is it possible to set a UserContext bean
in Spring (scoped "session") from the AuthenticatedWebSession ? Spring
provides some nice AOP proxy services with spring beans.
Ravi
--
View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Daniel Stoch <da...@gmail.com>.
You can see SpringWebApplication class to see how to access Spring
application context.
Or you can create a field with @SpringBean annotation to inject your
bean into the session object. But then you must call
InjectorHolder.getInjector().inject(this); before access this bean
(probably the best place for this is a session constructor).
Daniel
On 2007-12-14, at 18:36, Ravi_116 wrote:
>
> Daniel,
> That worked !! thanks...
> How can i access the Spring Application Context in the wicket
> MyApplicationWebSession (extends AuthenticatedWebSession) to
> retrieve the
> bean and set the user name and password.
> Ravi
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Ravi_116 <ra...@gmail.com>.
I found an earlier post that had the same question. Sorry for the same
question.
http://www.nabble.com/Spring-bean-in-session-with-annotation-td13817750.html#a13817750
Ravi
Ravi_116 wrote:
>
> Daniel,
> That worked !! thanks...
> How can i access the Spring Application Context in the wicket
> MyApplicationWebSession (extends AuthenticatedWebSession) to retrieve the
> bean and set the user name and password.
> Ravi
>
>
>
>
> Daniel Stoch-2 wrote:
>>
>> Have you defined RequestContextListener in your web.xml? It is
>> required for request scope and session scope beans:
>>
>> <listener>
>> <listener-class>
>> org.springframework.web.context.request.RequestContextListener
>> </listener-class>
>> </listener>
>>
>> Daniel
>>
>> On Dec 14, 2007 7:36 AM, Ravi_116 <ra...@gmail.com> wrote:
>>>
>>>
>>> Caused by: org.springframework.beans.factory.BeanCreationException:
>>> Error
>>> creating bean with name 'inquiryEngine' defined in class path resource
>>> [lingo-context.xml]: Cannot resolve reference to bean 'userContext'
>>> while
>>> setting bean property 'userContext'; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error creating
>>> bean
>>> with name 'userContext': Scope 'session' is not active for the current
>>> thread; consider defining a scoped proxy for this bean if you intend to
>>> refer to it from a singleton; nested exception is
>>> java.lang.IllegalStateException: No thread-bound request found: Are you
>>> referring to request attributes outside of an actual web request? If you
>>> are
>>> actually operating within a web request and still receive this
>>> message,your
>>> code is probably running outside of DispatcherServlet/DispatcherPortlet:
>>> In
>>> this case, use RequestContextListener or RequestContextFilter to expose
>>> the
>>> current request.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14339738.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Ravi_116 <ra...@gmail.com>.
Daniel,
That worked !! thanks...
How can i access the Spring Application Context in the wicket
MyApplicationWebSession (extends AuthenticatedWebSession) to retrieve the
bean and set the user name and password.
Ravi
Daniel Stoch-2 wrote:
>
> Have you defined RequestContextListener in your web.xml? It is
> required for request scope and session scope beans:
>
> <listener>
> <listener-class>
> org.springframework.web.context.request.RequestContextListener
> </listener-class>
> </listener>
>
> Daniel
>
> On Dec 14, 2007 7:36 AM, Ravi_116 <ra...@gmail.com> wrote:
>>
>>
>> Caused by: org.springframework.beans.factory.BeanCreationException: Error
>> creating bean with name 'inquiryEngine' defined in class path resource
>> [lingo-context.xml]: Cannot resolve reference to bean 'userContext' while
>> setting bean property 'userContext'; nested exception is
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'userContext': Scope 'session' is not active for the current
>> thread; consider defining a scoped proxy for this bean if you intend to
>> refer to it from a singleton; nested exception is
>> java.lang.IllegalStateException: No thread-bound request found: Are you
>> referring to request attributes outside of an actual web request? If you
>> are
>> actually operating within a web request and still receive this
>> message,your
>> code is probably running outside of DispatcherServlet/DispatcherPortlet:
>> In
>> this case, use RequestContextListener or RequestContextFilter to expose
>> the
>> current request.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14339710.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Daniel Stoch <da...@gmail.com>.
Have you defined RequestContextListener in your web.xml? It is
required for request scope and session scope beans:
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
Daniel
On Dec 14, 2007 7:36 AM, Ravi_116 <ra...@gmail.com> wrote:
>
>
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'inquiryEngine' defined in class path resource
> [lingo-context.xml]: Cannot resolve reference to bean 'userContext' while
> setting bean property 'userContext'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'userContext': Scope 'session' is not active for the current
> thread; consider defining a scoped proxy for this bean if you intend to
> refer to it from a singleton; nested exception is
> java.lang.IllegalStateException: No thread-bound request found: Are you
> referring to request attributes outside of an actual web request? If you are
> actually operating within a web request and still receive this message,your
> code is probably running outside of DispatcherServlet/DispatcherPortlet: In
> this case, use RequestContextListener or RequestContextFilter to expose the
> current request.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Igor Vaynberg <ig...@gmail.com>.
this is a spring error not a wicket one. im guessing there is some
sort of a filter you need to map to web.xml that lets spring retrieve
the http session.
-igor
On Dec 13, 2007 10:36 PM, Ravi_116 <ra...@gmail.com> wrote:
>
>
> Caused by: org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'inquiryEngine' defined in class path resource
> [lingo-context.xml]: Cannot resolve reference to bean 'userContext' while
> setting bean property 'userContext'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'userContext': Scope 'session' is not active for the current
> thread; consider defining a scoped proxy for this bean if you intend to
> refer to it from a singleton; nested exception is
> java.lang.IllegalStateException: No thread-bound request found: Are you
> referring to request attributes outside of an actual web request? If you are
> actually operating within a web request and still receive this message,your
> code is probably running outside of DispatcherServlet/DispatcherPortlet: In
> this case, use RequestContextListener or RequestContextFilter to expose the
> current request.
> at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:274)
> at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1274)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1042)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
> at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174)
> at
> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:887)
> at
> org.apache.wicket.spring.SpringBeanLocator.lookupSpringBean(SpringBeanLocator.java:240)
> at
> org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:166)
> at
> org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.testLocator(AnnotProxyFieldValueFactory.java:126)
>
>
> Ravi
>
>
>
> igor.vaynberg wrote:
> >
> > show us the complete stack trace
> >
> > -igor
> >
> >
> > On Dec 13, 2007 9:08 PM, Ravi_116 <ra...@gmail.com> wrote:
> >>
> >> Igor,
> >>
> >> The exception happens while loading the spring config files -
> >>
> >> Caused by: java.lang.IllegalStateException: No thread-bound request
> >> found:
> >> Are you referring to request attributes outside of an actual web request?
> >> If
> >> you are actually operating within a web request and still receive this
> >> message,your code is probably running outside of
> >> DispatcherServlet/DispatcherPortlet: In this case, use
> >> RequestContextListener or RequestContextFilter to expose the current
> >> request.
> >>
> >> Here is the definition of spring beans -
> >>
> >> <!-- a HTTP Session-scoped bean exposed as a proxy -->
> >> <bean id="userContext" class="com.foo.UserContext" scope="session">
> >> <!-- this next element effects the proxying of the surrounding
> >> bean -->
> >> <aop:scoped-proxy/>
> >> </bean>
> >>
> >> The init method the MyWebApplication.java (extends wicket
> >> AuthenticatedWebApplication)
> >>
> >> SpringComponentInjector springComponentInjector = new
> >> SpringComponentInjector(this);
> >> addComponentInstantiationListener(springComponentInjector);
> >>
> >> From the exception, it seems like spring is not aware of the HttpContext
> >> created by wicket.
> >> Thanks,
> >> Ravi
> >>
> >>
> >>
> >>
> >> igor.vaynberg wrote:
> >> >
> >> > i think it should work, you simply have to declare the bean as
> >> > scope=session in spring config
> >> >
> >> > -igor
> >> >
> >> >
> >> > On Dec 13, 2007 3:57 PM, Ravi_116 <ra...@gmail.com> wrote:
> >> >>
> >> >> I am a newbie to wicket. Our wicket application is integrated with
> >> Spring
> >> >> using the SpringComponentInjector. Is it possible to set a
> >> UserContext
> >> >> bean
> >> >> in Spring (scoped "session") from the AuthenticatedWebSession ? Spring
> >> >> provides some nice AOP proxy services with spring beans.
> >> >> Ravi
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330289.html
> >>
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330902.html
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Ravi_116 <ra...@gmail.com>.
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'inquiryEngine' defined in class path resource
[lingo-context.xml]: Cannot resolve reference to bean 'userContext' while
setting bean property 'userContext'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'userContext': Scope 'session' is not active for the current
thread; consider defining a scoped proxy for this bean if you intend to
refer to it from a singleton; nested exception is
java.lang.IllegalStateException: No thread-bound request found: Are you
referring to request attributes outside of an actual web request? If you are
actually operating within a web request and still receive this message,your
code is probably running outside of DispatcherServlet/DispatcherPortlet: In
this case, use RequestContextListener or RequestContextFilter to expose the
current request.
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:274)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1274)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1042)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:887)
at
org.apache.wicket.spring.SpringBeanLocator.lookupSpringBean(SpringBeanLocator.java:240)
at
org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:166)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.testLocator(AnnotProxyFieldValueFactory.java:126)
Ravi
igor.vaynberg wrote:
>
> show us the complete stack trace
>
> -igor
>
>
> On Dec 13, 2007 9:08 PM, Ravi_116 <ra...@gmail.com> wrote:
>>
>> Igor,
>>
>> The exception happens while loading the spring config files -
>>
>> Caused by: java.lang.IllegalStateException: No thread-bound request
>> found:
>> Are you referring to request attributes outside of an actual web request?
>> If
>> you are actually operating within a web request and still receive this
>> message,your code is probably running outside of
>> DispatcherServlet/DispatcherPortlet: In this case, use
>> RequestContextListener or RequestContextFilter to expose the current
>> request.
>>
>> Here is the definition of spring beans -
>>
>> <!-- a HTTP Session-scoped bean exposed as a proxy -->
>> <bean id="userContext" class="com.foo.UserContext" scope="session">
>> <!-- this next element effects the proxying of the surrounding
>> bean -->
>> <aop:scoped-proxy/>
>> </bean>
>>
>> The init method the MyWebApplication.java (extends wicket
>> AuthenticatedWebApplication)
>>
>> SpringComponentInjector springComponentInjector = new
>> SpringComponentInjector(this);
>> addComponentInstantiationListener(springComponentInjector);
>>
>> From the exception, it seems like spring is not aware of the HttpContext
>> created by wicket.
>> Thanks,
>> Ravi
>>
>>
>>
>>
>> igor.vaynberg wrote:
>> >
>> > i think it should work, you simply have to declare the bean as
>> > scope=session in spring config
>> >
>> > -igor
>> >
>> >
>> > On Dec 13, 2007 3:57 PM, Ravi_116 <ra...@gmail.com> wrote:
>> >>
>> >> I am a newbie to wicket. Our wicket application is integrated with
>> Spring
>> >> using the SpringComponentInjector. Is it possible to set a
>> UserContext
>> >> bean
>> >> in Spring (scoped "session") from the AuthenticatedWebSession ? Spring
>> >> provides some nice AOP proxy services with spring beans.
>> >> Ravi
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330289.html
>>
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330902.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Igor Vaynberg <ig...@gmail.com>.
show us the complete stack trace
-igor
On Dec 13, 2007 9:08 PM, Ravi_116 <ra...@gmail.com> wrote:
>
> Igor,
>
> The exception happens while loading the spring config files -
>
> Caused by: java.lang.IllegalStateException: No thread-bound request found:
> Are you referring to request attributes outside of an actual web request? If
> you are actually operating within a web request and still receive this
> message,your code is probably running outside of
> DispatcherServlet/DispatcherPortlet: In this case, use
> RequestContextListener or RequestContextFilter to expose the current
> request.
>
> Here is the definition of spring beans -
>
> <!-- a HTTP Session-scoped bean exposed as a proxy -->
> <bean id="userContext" class="com.foo.UserContext" scope="session">
> <!-- this next element effects the proxying of the surrounding
> bean -->
> <aop:scoped-proxy/>
> </bean>
>
> The init method the MyWebApplication.java (extends wicket
> AuthenticatedWebApplication)
>
> SpringComponentInjector springComponentInjector = new
> SpringComponentInjector(this);
> addComponentInstantiationListener(springComponentInjector);
>
> From the exception, it seems like spring is not aware of the HttpContext
> created by wicket.
> Thanks,
> Ravi
>
>
>
>
> igor.vaynberg wrote:
> >
> > i think it should work, you simply have to declare the bean as
> > scope=session in spring config
> >
> > -igor
> >
> >
> > On Dec 13, 2007 3:57 PM, Ravi_116 <ra...@gmail.com> wrote:
> >>
> >> I am a newbie to wicket. Our wicket application is integrated with Spring
> >> using the SpringComponentInjector. Is it possible to set a UserContext
> >> bean
> >> in Spring (scoped "session") from the AuthenticatedWebSession ? Spring
> >> provides some nice AOP proxy services with spring beans.
> >> Ravi
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330289.html
>
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Ravi_116 <ra...@gmail.com>.
Igor,
The exception happens while loading the spring config files -
Caused by: java.lang.IllegalStateException: No thread-bound request found:
Are you referring to request attributes outside of an actual web request? If
you are actually operating within a web request and still receive this
message,your code is probably running outside of
DispatcherServlet/DispatcherPortlet: In this case, use
RequestContextListener or RequestContextFilter to expose the current
request.
Here is the definition of spring beans -
<!-- a HTTP Session-scoped bean exposed as a proxy -->
<bean id="userContext" class="com.foo.UserContext" scope="session">
<!-- this next element effects the proxying of the surrounding
bean -->
<aop:scoped-proxy/>
</bean>
The init method the MyWebApplication.java (extends wicket
AuthenticatedWebApplication)
SpringComponentInjector springComponentInjector = new
SpringComponentInjector(this);
addComponentInstantiationListener(springComponentInjector);
>From the exception, it seems like spring is not aware of the HttpContext
created by wicket.
Thanks,
Ravi
igor.vaynberg wrote:
>
> i think it should work, you simply have to declare the bean as
> scope=session in spring config
>
> -igor
>
>
> On Dec 13, 2007 3:57 PM, Ravi_116 <ra...@gmail.com> wrote:
>>
>> I am a newbie to wicket. Our wicket application is integrated with Spring
>> using the SpringComponentInjector. Is it possible to set a UserContext
>> bean
>> in Spring (scoped "session") from the AuthenticatedWebSession ? Spring
>> provides some nice AOP proxy services with spring beans.
>> Ravi
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330289.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Using Spring beans with session scope
Posted by Igor Vaynberg <ig...@gmail.com>.
i think it should work, you simply have to declare the bean as
scope=session in spring config
-igor
On Dec 13, 2007 3:57 PM, Ravi_116 <ra...@gmail.com> wrote:
>
> I am a newbie to wicket. Our wicket application is integrated with Spring
> using the SpringComponentInjector. Is it possible to set a UserContext bean
> in Spring (scoped "session") from the AuthenticatedWebSession ? Spring
> provides some nice AOP proxy services with spring beans.
> Ravi
>
> --
> View this message in context: http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org