<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);
}
}你试试
解决方案 »
- 关于JQuery easyUI的datagrid问题
- weblogic 提示<BEA-000421> <Uncaught Throwable in processSockets
- 帮帮看看哪里数组索引越界了
- 诡异的mysql存储过程问题,讨厌的换行!
- 读取Hibernate属性文件
- struts2中action跳转action问题
- Jboss+JbuilderX连接数据库连接池!!和奇怪!我明明是用的OracleDS这个连接池的JNDI可是他怎么总是在SqlServer中访问数据??
- weblogic7.0过期了,请问谁有永久性的lisence,能否给我发个csdn短信给我吗?感激不尽.
- 如何将网页中的内容保存成文本
- 不知道点了什么,导致Eclipse中文件打开格式总是文本,快哭了
- struts類问题
- 关于sun的事例代码petstore的编译问题,请赐教
我想用struts的plugin方式把spring启动.可是就是初始化失败