classpath:spring-injection.xml 这里不懂。
这是哪一个知识点,在哪个文件配置的文件参数呢?看到这里一脸懵逼~~~
这是哪一个知识点,在哪个文件配置的文件参数呢?看到这里一脸懵逼~~~
 
                            2016-04-05
        private ApplicationContext ctx;
	
	@Before
	public void init(){
		ctx=new  ClassPathXmlApplicationContext("spring-injection.xml");
	}
	
	
	@Test
	public void testSetter(){
		//ApplicationContext ctx=new  ClassPathXmlApplicationContext("spring-injection.xml");
		InjectionService service = (InjectionService) ctx.getBean("injectionService");
		service.save("为什么会这样子呢?");
	}这是我根据helloworld方法改的测试方法,也可以实现。
不过就是不懂 super("XML文件") 为什么行不通。。
package com.imooc.test.ioc.injection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import com.imooc.ioc.injection.service.InjectionService;
@RunWith(BlockJUnit4ClassRunner.class)
public class TestInjection {
	public TestInjection(){
		super("spring-injection.xml");
	}
	
	@Test
	public void testSetter(){
		//InjectionService service = super
	}
}super那个出错了提示The constructor Object(String) is undefined
下面是我的项目结构,用的是myeclipse


没弄懂为什么super()出现什么问题,我上网去看一些helloworld可以用下面这方法读取解析xml文件。
ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationcontext.xml");
HelloWorld helloworld=(HelloWorld)ctx.getBean("helloworld");
举报