简体   繁体   English

找不到元素“ context:property-placeholder”的声明

[英]Cannot found declaration for element “context:property-placeholder”

Im a Spring beginner. 我是春季初学者。 I browsed this and only got this note 我浏览了这个,只得到了这个笔记

My two xml files: 我的两个xml文件:

one.xml one.xml

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
    <entry key="url">stackoverflow.com/</entry>
</properties>

second.xml second.xml

<?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:security="http://www.springframework.org/schema/security"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/security
    http://www.springframework.org/schema/security/spring-security-3.0.xsd"            
 >

<context:property-placeholder location="classpath:config.xml" />

<security:authentication-manager>
  <security:ldap-server url="${url}" 
    manager-dn="XXX" manager-password="XXX" />
</beans>

I get the Exception is: 我得到的异常是:

Cannot found declaration for element "context:property-placeholder" 找不到元素“ context:property-placeholder”的声明

for context schema namespace you didn't specify the schema location. 对于上下文模式名称空间,您未指定模式位置。 change you beans declaration like this. 这样更改您的bean声明。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM