通配符的匹配很全面, 但无法找到元素 'context:property-placeholder'
2018-01-26 22:48
267 查看
这是我在学习spring的时候遇到的一个错误,下面我给大家介绍一种解决方案:
其实主要是我们在引入命名空间时没有正确引入它的DTD解析文件,当然你必须在把Spring相应的包导入正确的情况下。
解决方案就是如下:
xmlns:context="http://www.springframework.org/schema/context"
同时在xsi:schemaLocation这个字符串中添加context相关的解析文件
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd。
其他的如util命名空间导入方式一样,只是把context换成相应util就可以了。
最终的代码如下:
本人小白,希望对大家的学习有所帮助
其实主要是我们在引入命名空间时没有正确引入它的DTD解析文件,当然你必须在把Spring相应的包导入正确的情况下。
解决方案就是如下:
xmlns:context="http://www.springframework.org/schema/context"
同时在xsi:schemaLocation这个字符串中添加context相关的解析文件
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd。
其他的如util命名空间导入方式一样,只是把context换成相应util就可以了。
最终的代码如下:
<?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-4.2.xsd"> <!--导入属性文件--> <context:property-placeholder location="classpath:db.properties"/> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="user" value="${user}"></property> <property name="password" value="${password}"></property> <property name="driverClass" value="${driverClass}"></property> <property name="jdbcUrl" value="${jdbcUrl}"></property> </bean> </beans>
本人小白,希望对大家的学习有所帮助
相关文章推荐
- 通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明
- Caused by: org.xml.sax.SAXParseException; 通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明。
- 通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明
- cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明
- cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明
- 通配符的匹配很全面, 但无法找到元素 'context:component-scan'
- 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。
- 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。
- spring 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明
- 关于spring”通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明“的错误
- 关于spring”通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明“的错误
- 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。
- 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。--问题的原因及解决方案
- 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明
- 关于spring”通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明“的错误
- 关于spring”通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明“的错误
- SpringMVC 出现通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。
- spring报错:通配符的匹配很全面, 但无法找到元素 'context:annotation-config' 的声明
- 通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明
- Spring中通配符的匹配很全面, 但无法找到元素