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?
You haven't defined what "context" is.
You need to add xmlns:context="http://www.springframework.org/schema/context"
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