我想創建會話範圍的Spring bean:春季會議範圍
<bean id="myClass" class="com.test.Myclass scope="session" />
當我試圖擺脫的ApplicationContext類的Servlet過濾器,就像這樣:
WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(config.getServletContext());
Myclass obj = (Myclass)applicationContext.getBean("myClass");
我收到以下錯誤:java.lang.IllegalStateException: No Scope registered for scope name 'session'
我沒有任何問題,如果我定義範圍作爲prototype
!我如何從applicationContext中檢索會話範圍的spring bean?
後的完整代碼 – developer