这是一个关于 Spring 配置的语法问题(参考 spring-beans-3.1.xsd 和 spring-mvc-3.1.xsd)。
我有一个特定的 bean 定义 (id="SecurityRequestParametersArgumentResolver"),我想将其注册为自定义参数解析器。xml片段是:
<bean id="SecurityRequestParametersArgumentResolver"
class="xxx.security.web.SecurityRequestParametersArgumentResolver">
<property name="credentialsManager" ref="CredentialsManager" />
<property name="tokenService" ref="TokenService" />
</bean>
... AND I would like to use a bean reference. The following three lines don't obey the xsd-grammar ( what should be the correct tag declaration here? )
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean ref="SecurityRequestParametersArgumentResolver"/>
</mvc:argument-resolvers>
</mvc:annotation-driven>
...我看到的所有示例看起来都像这样,因此都在使用默认的无参数构造函数
<mvc:annotation-driven>
<mvc:argument-resolvers>
<bean class="class="xxx.security.web.SecurityRequestParametersArgumentResolver"/>
</mvc:argument-resolvers>
</mvc:annotation-driven>
重复这个问题,为了使用 bean 引用作为自定义参数解析器,Spring 语法应该是什么?
谢谢!