gpt4 book ai didi

spring-mvc - spring mvc 3-上下文:property-placeholder is not bound

转载 作者:行者123 更新时间:2023-12-01 22:56:46 25 4
gpt4 key购买 nike

我正在使用 spring 3.0.5 并尝试通过上下文元素读取配置文件:

<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"/>

当应用程序启动时,我收到以下错误:

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.



我究竟做错了什么?

最佳答案

您还没有定义“上下文”是什么。

您需要添加 xmlns:context="http://www.springframework.org/schema/context"

关于spring-mvc - spring mvc 3-上下文:property-placeholder is not bound,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7984848/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com