Reputation: 4122
I have been trying following:
<beans 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:jee="http://www.springframework.org/schema/jee"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
................
>
<bean id="dateBean" class="org.apache.velocity.tools.generic.NumberTool"/>
<bean id="service" class="package.xyz">
<property name="toolMap">
<util:map map-class="java.util.HashMap">
<entry key="number"><ref:bean="dateBean"/></entry>
</util:map>
</property>
</bean>
As you can see this is for Velocity Tool Configuration.
I get this exception :
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'util:map'.
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'util:map'.
Can anyone help me to fix this issue?
Updated: I have added the XML declarations .
Upvotes: 1
Views: 3508
Reputation: 38205
Don't use <util:map>
for this use-case. That is actually an alias for a MapFactoryBean
.
Use the classic <map>
element instead and it should work.
Upvotes: 2
Reputation: 340763
Your XML header should look like this (pay attention to proper header declarations):
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<!-- ... -->
As described in C.2.2 The util schema.
Upvotes: 2