【发布时间】:2016-12-29 21:24:03
【问题描述】:
我的 spring 库:3.2.0
XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
<bean id = "res_Bean" class = "Restaurant"
<property name="welcomeNote" value="welcome to my restaurant"/>
</bean>
</beans>
我正在尝试解决,但我没有得到正确的答案。
线程“main”中的异常 java.lang.IllegalStateException:BeanFactory 未初始化或已关闭 - 在访问之前调用“刷新” bean 通过 ApplicationContext 在 org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:172) 在 org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117) 在 TestSpring.main(TestSpring.java:12)
【问题讨论】:
-
在
TestSpring.java:12显示代码怎么样 -
请显示主要方法。
-
主要方法代码ideone.com/SJpSrR
标签: java spring spring-mvc dependencies