Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring mvc 3- context:property-placeholder is not bound

Tags:

spring-mvc

I'm working with spring 3.0.5 and trying to read a configuration file through the context element:

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

<context:property-placeholder location="classpath:db_config.properties"/>

When the application starts up, I get the following error:

Offending resource: ServletContext resource [/WEB-INF/spring/applicationContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 20 in XML document from ServletContext resource [/WEB-INF/spring/db-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The prefix "context" for element "context:property-placeholder" is not bound.

What am I doing wrong?

like image 981
Deepak Marur Avatar asked Nov 29 '22 17:11

Deepak Marur


1 Answers

You haven't defined what "context" is.

You need to add xmlns:context="http://www.springframework.org/schema/context"

like image 53
Josh Avatar answered Dec 05 '22 12:12

Josh