cvc-complex-type.2.4.c:匹配的通配符是strict,但是找不到元素'tx:annotation-driven'的声明

osh*_*osh 4 spring spring-mvc

如果我不粘贴 xmlns:tx="http://www.springframework.org/schema/tx" 那么没有问题.但是,如果我插入文本,我得到一个cvc-complex-type.2.4.c:匹配的通配符是严格的,但是没有找到元素'tx:annotation-driven'错误的声明.

<beans xmlns:tx="http://www.springframework.org/schema/tx" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">

    <context:annotation-config />
    <tx:annotation-driven /> 
<context:component-scan base-package="ne.projl.server" />

    <bean name="security.securityInfo" class="org.geomajas.security.SecurityInfo">
        <property name="loopAllServices" value="false" />
        <property name="securityServices">
            <list>
                <bean class="org.geomajas.security.allowall.AllowAllSecurityService" />
            </list>
        </property>
    </bean>

    <bean name="puregwt-app" class="org.geomajas.configuration.client.ClientApplicationInfo">
        <property name="maps">
            <list>
                <ref bean="mapOsm" />
<!--                <ref bean="mapWms" /> -->
<!--                <ref bean="mapLegend" /> -->
<!--                <ref bean="mapLayerVisibility" /> -->
<!--                <ref bean="mapCountries" /> -->
<!--                <ref bean="mapEmpty" /> -->
<!--                <ref bean="mapPrinting" /> -->
            </list>
        </property>
    </bean>
<bean class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean" id="entityManagerFactory">
        <property name="persistenceUnitName" value="MyPUnit" />
    </bean>

    <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>
</beans>
Run Code Online (Sandbox Code Playgroud)

我也试过修改<tx:annotation-driven />如下:<tx:annotation-driven transaction-manager="transactionManager"/>

Kev*_*sox 9

<beans>标签中从未提供tx的架构位置.请注意所提供配置的最后一行的更改.配置混合Spring 2.0和2.5,我不确定是否需要,但我想让你意识到这一点.

<beans xmlns:tx="http://www.springframework.org/schema/tx" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
Run Code Online (Sandbox Code Playgroud)