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

java.lang.IllegalStateException: BeanFactory

2015-08-27 21:55 309 查看
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

原因:WEB-INFO目录下没有创建applicationContext.xml

创建:applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"

    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.xsd"

    default-lazy-init="true">

    <context:annotation-config />

    <!-- Activates scanning of @Repository and @Service -->

    <context:component-scan base-package="net.ren" />

    <!-- Add new Managers here -->

</beans>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息