BeanFactory not initialized or already closed - call 'refresh' before access
错误:
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
错误原因:
BeanFactory没有实例化或者已经关闭。
原因很简单:ApplicationContext ctx = new ClassPathXmlApplicationContext();
Spring实例化BeanFactory的时候是默认到classPath下面查找名为applicationContext.xml的文件。
这正是这个错误的原因,修改为:ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
如果这样的话就不会出现这样的错误了。applicationContext.xml,可以是自己命名的xml。
如果之前使用正常,后面抽风出现这种问题,Clear Project一般就可以了
BeanFactory not initialized or already closed - call 'refresh' before access相关推荐
- maven项目-加载不到spring文件,BeanFactory not initialized or already closed - call 'refresh' bef
严重: Exception sending context initialized event to listener instance of class org.springframework.we ...
- BeanFactory not initialized or already closed - call ‘refresh‘ before accessing beans via the Applic
背景: 启动报错: 严重: Exception sending context destroyed event to listener instance of class org.springfram ...
- BeanFactory not initialized or already closed - call 'refresh' before accessing beans
BeanFactory没有实例化或者已经关闭了,其实产生错误的原因很简单,没有正确找到Spring配置文件. Spring实例化BeanFactory的时候是默认到classPath下面查找名为app ...
- 开发运维日常坑 总结 51-100
51.json 好多种 JsonArray fromObject = JSONArray.fromObject(list<obj>); String string = fromObject ...
- spring+ (activeMQ) 实现queue与topic
2019独角兽企业重金招聘Python工程师标准>>> 2017-06-17 1.activeMQ下载与安装 前往Apache官网下载ActiveMQ,下载地址http://acti ...
- boot spring 没有父子容器_Spring父子容器问题
这个问题老早就存在了,只是今天组长让我看AOP不生效的时候,才真实遇到这个问题,之前都是用的Spring Boot开发,不会存在这个问题. 问题描述 如果使用传统的方式来开发Spring项目,要部署在 ...
- Aop获取bean的过程---spring debug
1.调试程序: IStudent person = (IStudent)ctx.getBean("student"); 2.AbstractApplicationContext.j ...
- Spring WebApplicationContext
WebApplicationContext是专门为web应用准备的,他允许从相对于web根目录的路劲中装载配置文件完成初始化工作,从WebApplicationContext中可以获得ServletC ...
- tomcat启动报错:Bean name 'XXX' is already used in this beans element
如题,tomcat容器启动时加载spring的bean,结果报错如下: 六月 28, 2017 9:02:25 上午 org.apache.tomcat.util.digester.SetProper ...
最新文章
- hdu4950 打怪(简单题目)
- 二分逼近二分查找 高效解析800万大数据之区域分布
- 为什么vs2005内置Web application server中调用COM组件时正常,在IIS中运行时组件创建失败?...
- python等差数列末项计算_Python 30道高频面试题及详细解答
- HDU1584 蜘蛛牌 DFS回溯
- 【转载】Eclipse vs IDEA快捷键对比大全(win系统)
- 【codevs2492】【Tyvj1941】上帝造题的七分钟2,线段树的特别技巧
- Linux的常用命令练习
- 【POJ 3041】Asteroids【网络流 —— 最小点覆盖】
- gns3 官网原版最新版GNS3-2.1.8-all-in-one
- 硬件工程师物料清单BOM对比工具
- 无线路由登不上服务器怎么办,192.168 2.1路由器登陆不了怎么办
- openwrt 怎么进入串口_OpenWrt路由器读取串口数据,建立tcp服务
- Linux中括号的使用
- 主分区、扩展分区、逻辑分区
- 前端——动态生成表格
- Unbuntu18.04系统定制化制作与再生龙镜像生成
- 丢掉迅雷,1M的下载神器让你下载飞起来,NDM/XDM分享
- vs使用教程3:(调试断点)
- phpBB使用教程教程详解