您的位置:首页 > 编程语言 > Java开发

maven项目-加载不到spring文件,BeanFactory not initialized or already closed - call 'refresh' bef

2016-11-12 22:33 615 查看
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [classpath:spring/applicationContext-*.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring/] cannot be resolved to URL because it does not exist

严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener

java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext



如果是maven项目 src / main / resources 目录下的文件路径没有问题才报错的话,就在项目的pom工程下,编辑pom.xml

<build>
<!-- 默认源代码和资源文件目录配置 -->
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring
相关文章推荐