我有个问题??????
package main.java.com.xiaodao.bean; public class BeanScope { public void say(){ System.out.println("BeanScope say:" +this.hashCode()); } } <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" > <bean id="beanScope" class="main.java.com.xiaodao.bean.BeanScope" scope="singleton"></bean> </beans> import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.BlockJUnit4ClassRunner; import main.java.com.xiaodao.bean.BeanScope; import test.java.com.xiaodao.test.base.UnitTestBase; @RunWith(BlockJUnit4ClassRunner.class) public class TestBeanScope extends UnitTestBase { public TestBeanScope() { super("classpath*:spring-beanscope.xml"); } @Test public void testSay() { BeanScope beanScope = super.getBean("beanScope"); beanScope.say(); } }
运行报错,No bean named 'beanScope' is defined
找不到定义为beanScope的bean