<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
</plug-in>我没用这种方式导入spring配置文件,我用下面的类
/*
* Created on Feb 14, 2006
*
* TODO Bean获取类,实现通过spring配置文件获取所有配置的Bean
*
*/
package gov.cd12366.bridge.spring;import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ClassPathResource;/**
* @author 魏锋
*
*
*
*/
public final class CustomBeanFactory {
static XmlBeanFactory factory = null;
static {
//读取spring配置文件,创建factory类
Resource is = new ClassPathResource("applicationContext_sigon.xml");
factory = new XmlBeanFactory(is);
}
//通过beanName获取bean的实例
public static Object getBean(String beanName){
return factory.getBean(beanName);
}
}你试试
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
</plug-in>我没用这种方式导入spring配置文件,我用下面的类
/*
* Created on Feb 14, 2006
*
* TODO Bean获取类,实现通过spring配置文件获取所有配置的Bean
*
*/
package gov.cd12366.bridge.spring;import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ClassPathResource;/**
* @author 魏锋
*
*
*
*/
public final class CustomBeanFactory {
static XmlBeanFactory factory = null;
static {
//读取spring配置文件,创建factory类
Resource is = new ClassPathResource("applicationContext_sigon.xml");
factory = new XmlBeanFactory(is);
}
//通过beanName获取bean的实例
public static Object getBean(String beanName){
return factory.getBean(beanName);
}
}你试试
我想用struts的plugin方式把spring启动.可是就是初始化失败