我在用application测试的时候,使用application app=new ClassPathXmlApplicationContext();
但是ClassPathXmlApplicationContext new 不来,大神,这是怎么回事?
------解决方案--------------------------------------------------------
ApplicationContext ctx = new ClassPathXmlApplicationContext("bean.xml");//Spring bean文件
ctx.getBean("beanName");//beanName
new 不出来 是不是没导jar包
ClassPathXmlApplicationContext 类在
package org.springframework.context.support;
下
------解决方案--------------------------------------------------------
- Java code
import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;ApplicationContext ctx = new ClassPathXmlApplicationContext();