Home  >  Forum  >  Spring
Post New Query

java.lang.IllegalStateException: No Scope registered for scope 'session'

joined on
March 27,2014
Asked on December 25,2015
I am trying to implement spring 'session' scope using XML, but getting the error as below. Any Idea?

Caused by: java.lang.IllegalStateException: No Scope registered for scope 'session'
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1475)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1220)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)

joined on
November 18,2013
Replied on December 29,2015

spring request, session, global session and application scope are meant for spring web application.
spring request scope is related to HTTP request.
spring session scope is related to HTTP session.
spring application scope is related to ServletContext.
spring global session scope is related to spring portlet application.

It means we can not use these scopes in standalone application. 
In case of dependency injection of short lived spring bean to long lived spring bean,
we need to use AOP proxy.
For more detail go to the URL

joined on
March 27,2014
Replied on December 29,2015

Nice Explanation.

Write Answer

Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us