cvc-complex-type.3.2.2:属性'local'不允许出现在元素'ref'中。 \t root-context.xml

问题描述:

我使用Spring框架,速度和sring休息完整的Web服务。 在它被使用 “” 抱怨我,我的根context.xml中被引用如下:cvc-complex-type.3.2.2:属性'local'不允许出现在元素'ref'中。 t root-context.xml

下面是完整的代码:

<?xml version="1.0" encoding="UTF-8"?> 

HTTP://www.springframework .ORG /模式/豆类/弹簧beans.xsd“>

<!-- Root Context: defines shared resources visible to all other web components --> 
<beans> 
<bean id="sender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> 
    <property name="host" value="smtp.gmail.com"/> 
    <property name="port" value="25"/> 
    <property name="username" value="[email protected]"/> 
    <property name="password" value="Jadeite1"/> 
    <property name="javaMailProperties"> 
     <props> 
      <prop key="mail.transport.protocol">smtp</prop> 
      <prop key="mail.smtp.auth">true</prop> 
      <prop key="mail.smtp.starttls.enable">true</prop> 
      <prop key="mail.debug">true</prop> 
     </props> 
    </property> 
    <property name="velocityEngine"> 
     <ref bean="velocityEngine"/> 

    </property> 

</bean>  


<bean id="emailEcardConfig" class="com.email.EcardMailConfig"> 

    <property name="from"> 
     <value>[email protected]</value> 
    </property> 


    <property name="subject"> 
     <value>Testing Email!</value> 
    </property> 


    <property name="htmlTemplatePath"> 
     <value>EcardHtmlTemplate.vm</value> 
    </property> 

    <property name="velocityEngine"> 
     <ref local="velocityEngine"/> 
    </property> 

</bean> 



<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"> 
<property name="resourceLoaderPath"><value>/WEB-INF/classes/velocity/</value></property> 

</bean> 


任何提示或帮助,非常感谢它!

+0

你读过的例外呢?这很清楚这个文件有什么问题。 –

从您的代码“本地”它不再允许在春季

<property name="velocityEngine"> 
    <ref local="velocityEngine"/> 
</property>