|
方法一:在初始化时保存ApplicationContext对象 代码: 方法二:通过Spring提供的工具类获取ApplicationContext对象
方法四:继承自抽象类WebApplicationObjectSupport 方法五:实现接口ApplicationContextAware 以上方法适合不同的情况,请根据具体情况选用相应的方法。
public class DicBean implements ServletContextAware{ private ServletContext servletContext; public void setServletContext(ServletContext sc) { |
详细解决方案
javaSpring获取Bean的几种模式
热度:224 发布时间:2012-10-13 11:38:17.0
相关解决方案
- spring+ibatis框架下的报错:Bean property 'meatOutInfoBaseDao' is not writable or has.该如何解决
- 可否用很简单的文字介绍一上JAVA BEAN
- [求助]jsp+bean+servlet
- JAVA BEAN
- bean:write 属性的问题
- 请教大家,我的通知内容不能阅读,JSP+BEAN 做的
- servlet与struts2共处,调用spring bean
- 异常:Cannot find bean under name org.apache.struts.taglib.html.BEAN
- Struts标签之Cannot find bean under name org.apache.struts.taglib.html.BEAN异常
- Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope 有关问题
- Weblogic下jar包被重复加载的有关问题:Bean type class com.opensymphony.xwork2.ObjectFactory with
- session bean 的了解
- JSP中怎么手动清除java bean
- jsonObject 转化 bean list 地图 array
- web起步加载servlet得到Spring bean
- JSON与JAVA的数据转换-Bean
- Spring中的<idref bean=""/><ref local=""/><idref local=""/><ref bean=""/>引见
- JSR 303 bean validation总算要出来了.
- struts2类自动注入的No unique bean of type的有关问题
- Bean 二 JSON USING XSTREAM
- servlet 中取得spring Bean 的方法
- json字符串转换成List<bean>
- script 调用 bean,该如何解决
- 关于spring bean 注入的一个有关问题
- spring bean 生命周期 有何用解决方法
- javabean有关问题:Cannot find any information on property 'TheName' in a bean of type '
- Spring注解出错:Error creating bean with name
- struts2 该如何保存set<Bean>类型
- 对List<Bean>模式的数据进行转换,对元素相同的属性进行归并处理,生成Map<K,V>格式
- spring + ejb3.x + jboss7.1 初始化不已本地的Local Bean