spring properties文件读取报错 context:property-placeholder" 的前缀 "context" 未绑定

1,通过spring的placeholder读取属性文件,报错如下

Caused by: org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 105; 元素 "context:property-placeholder" 的前缀 "context" 未绑定。

    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)

2,修复方法

在spring配置文件头上添加context头

xmlns:context="http://www.springframework.org/schema/context"
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd

猜你喜欢

转载自blog.csdn.net/Architect_CSDN/article/details/83502469