BeanFactory not initialized or already closed - call 'refresh' before access

简介: BeanFactory not initialized or already closed - call 'refresh' before access

不多说,就是配置文件头引入不到位

 

启用注解时

applicationContext.xml文件头部需要加入

xmlns:context="http://www.springframework.org/schema/context"  

但是接着会报错误

BeanFactory not initialized or already closed - call 'refresh' before access

原因是还要在bean头文件中加入http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-2.5.xsd

bean头文件配置

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
  http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-3.0.xsdx
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <context:annotation-config/>
目录
相关文章
|
Serverless
attempt to delete a method
attempt to delete a method
223 1
getReader() has already been called for this request
getReader() has already been called for this request
1690 0
getReader() has already been called for this request
|
7月前
|
NoSQL 编译器 API
关于thread使用的错误:pure virtual method called terminate called without an active exception
关于thread使用的错误:pure virtual method called terminate called without an active exception
160 1
shiro学习之错误 No realms have been configured! One or more realms must be present to execute an authori
shiro学习之错误 No realms have been configured! One or more realms must be present to execute an authori
|
Web App开发 前端开发
【前端异常】Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
【前端异常】Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.
863 0
|
7月前
|
TensorFlow 算法框架/工具 Python
完美解决丨RuntimeError: create_session() called before __init__().
完美解决丨RuntimeError: create_session() called before __init__().
|
Java Spring
【新手指南】严重: Exception sending context initialized event to listener instance of class
【新手指南】严重: Exception sending context initialized event to listener instance of class
557 0
【新手指南】严重: Exception sending context initialized event to listener instance of class
|
XML Java 数据格式
Exception encountered during context initialization - cancelling refresh attempt
Exception encountered during context initialization - cancelling refresh attempt:
344 0
BeanFactory not initialized or already closed
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext
149 0
|
Java Apache Spring
Exception sending context initialized event to listener instance of class
详细错误信息如下: 严重: Exception sending context initialized event to listener instance of class com.auth.spring.
1230 0