spring 配置无法从相对位置导入 bean 定义

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16643456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 05:59:14  来源:igfitidea点击:

Configuration Failed to import bean definitions from relative location

spring

提问by Venu Annaram

My folder structure is:

我的文件夹结构是:

src/main---java
           resources/META-INF/Spring-context/application.xml
           webapp/WEB-INF--web.xml
                           despatcher-servlet.xml

from webapp/WEB-INF/despatcher-servleti am trying to import application.xml like

webapp/WEB-INF/despatcher-servlet我试图导入 application.xml 之类的

<import resource="classes/META-INF/spring-context/application.xml"/>

getting exception like Configuration problem: Failed to import bean definitions from relative location [classes/META-INF/springcontext/application.xml]Can any one help me.

遇到类似配置问题的异常:无法从相对位置导入 bean 定义[classes/META-INF/springcontext/application.xml]任何人都可以帮助我。

回答by Karthikeyan Vaithilingam

Your configuration file is in classpath so you have to use classpath:prefix also remove classes from the path. Your settings will be:

您的配置文件在类路径中,因此您必须使用classpath:前缀也从路径中删除类。您的设置将是:

classpath:META-INF/springcontext/application.xml