0

@Scope アノテーションを使用して Bean のスコープを変更しようとしました。その Bean は実際には MessageSource として機能し、国際化の目的で使用されます。

mvc-dispacher-servlet.xml のスキーマは次のとおりです。

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

コンソールに記載されている例外は次のとおりです。

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [scoped-proxy]

4

2 に答える 2

0

Ok。通常の Bean の場合、スコープ タグの xml パーサーが欠落している可能性が最も高いです。スコープ付きプロキシを使用できるようにするには、aop:scoped-proxy を登録する必要があります。

SO にも同様の質問があります: Accessing a session-scoped Bean inside a controller

結果は次のとおりです。

http://static.springsource.org/spring/docs/3.0.x/reference/beans.html#beans-factory-scopes-other-injection

それ以外の場合は、Google でこのトピックに関するチュートリアルを簡単に見つけることができます。

于 2013-03-17T06:46:17.340 に答える