could anyone help me resolving the following error as i am new to spring?
cvc-complex-type.2.4.c: The matching wildcard is strict, but no
declaration can be found for element 'context:property-placeholder'.
I have the following configuration in applicationContext.xml:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
xmlns:context="http://www.springframework.org/schema/context">
<bean id="dataSource"class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<context:property-placeholder location="src/jdbc.properties"/>
Spring provides a bunch of additional name-spaces that provide short-hand ways to do things - things like tx (transactions), util (utils), mvc (spring MVC declarations):
To use one, you have to set up the schema mapping in your XML file. If this is done, you get basic code-completion (your IDE may provide more). .
In your declaration context was not set-up/mapped.
Change your declaration to the following:
<?xml version="1.0" encoding="UTF-8"?>
<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"
xsi:schemaLocation="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-3.0.xsd">
</beans>
You can also set up your own namespaces for in-house components, if you wish.
If you use Spring >= 3.1, use PropertySourcesPlaceholderConfigurer rather than the old.
Workaround: Replace
<context:property-placeholder location="classpath:sport.properties"/>
BY
`
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:sport.properties</value>
</property>
</bean>
`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With