I have a Spring MvC project using JPA and Oracle as DB, I have this bean declaration in my servlet.xml file, but when I run a test
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx/spring-tx.xsd">
<bean id="bbtra"
class="com.bonanza.commons.services.TranslationDB"
autowire-candidate="true">
<property name="dataSource" ref="dataSource" />
<aop:scoped-proxy/>
</bean>
I got this error:
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:scoped-proxy'.
Usually the *.xsd
files are referenced by https://
instead of http://
, but that is not the problem, I am just mentioning it. The minimal change to your XML file fixing the problem is moving up spring-tx.xsd
to be right behind tx
. Then also the highlighting in your XML editor changes, i.e. in IntelliJ IDEA you will see the AOP stuff go from grey to green. What I mean is:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
"
>
<bean id="bbtra"
class="com.bonanza.commons.services.TranslationDB"
autowire-candidate="true">
<property name="dataSource" ref="dataSource" />
<aop:scoped-proxy/>
</bean>
</beans>
Now all schema locations schema/foo
and schema/foo/spring-foo.xsd
form pairs.