来自嵌套导入资源的springbean引用

来自嵌套导入资源的springbean引用,spring,import,javabeans,Spring,Import,Javabeans,我有一个spring配置文件service.xml ,它导入applicationContext.xml,而my applicationContext.xml导入security.xml 现在在我的service.xml中定义了一个bean <bean id="mySecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor"> <property

我有一个spring配置文件service.xml ,它导入applicationContext.xml,而my applicationContext.xml导入security.xml

现在在我的service.xml中定义了一个bean

<bean id="mySecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="validationActions" value="UsernameToken" />
<property name="securementActions" value="UsernameToken" />
<property name="validationCallbackHandler" ref="myPasswordCallbackHandler" />
以下是我的myPasswordCallbackHandler def:

<beans:bean id="myPasswordCallbackHandler"
  class="org.springframework.ws.soap.security.wss4j.callback.SpringPlainTextPasswordValidationCallbackHandler">
<beans:property name="authenticationManager" ref="authenticationManager"/>


看起来你可能在某个地方输入了错误,在你的帖子中有两个bean的引用:
mySecurityPasswordCallbackHandler
myPasswordCallbackHandler
。确保您使用的名称正确。

不确定这是否有帮助,但您能否尝试显式名称取决于

<bean id="mySecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor" depends-on="myPasswordCallbackHandler">
<property name="validationActions" value="UsernameToken" />
<property name="securementActions" value="UsernameToken" />
<property name="validationCallbackHandler" ref="myPasswordCallbackHandler" />


假设您有一个名为myPasswordCallbackHandler的bean,并且所有导入语句都是正确的,我看不出该用法有任何问题。

您能发布myPasswordCallbackHandler定义吗?确切的错误(可能还有其他有用的信息)?这应该可以,你能提供更多信息吗?或者,他也可以省略mySecurityInterceptor上的validationCallbackHandler属性,并设置autowire=“byType”,假设myPasswordCallbackHandler是该类型的唯一实例。@Beau:Yup,编辑堆栈跟踪时键入,因为这些不是真正的豆名。考虑MySualTysPosidCaldBuffer-Healthor是MyPaseWordCaldBuffer-Load。@ USER 620333,所以您的代码中的所有引用/定义既不是代码,也不是代码> >代码> MyPaseWordCaldBuffer-TraceBuffer-<代码>,这与我引用bean的嵌套导入有关系吗?引用在同一个security.xml文件中-嵌套在这里不是问题。
<bean id="mySecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor" depends-on="myPasswordCallbackHandler">
<property name="validationActions" value="UsernameToken" />
<property name="securementActions" value="UsernameToken" />
<property name="validationCallbackHandler" ref="myPasswordCallbackHandler" />