天天看点

java.lang.IllegalStateException: BeanFactory

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>

继续阅读