使用ClassPathXmlApplicationContext的start方法与利用web容器去初始化配置BEAN有什么区别?ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext(configPath.split("[,\\s]+"));
context.start();好像start做的事情会多点,请问多了哪些?如果我要用容器初始化的话,如何操作相同事情?
解决方案 »
- 搭建SSH时候出的问题,请高手帮忙解答,我用的是MyEclipse7.0
- Struts标签的问题
- struts中的logic的使用!!!求助!!!!!急急急!!!!
- 为什么我一用lomboz插件, eclipse就卡得要死????有高手赐教没?注:请不要建议小弟用其它的插件
- tomcat配置的问题,以前这样配置都没问题的
- 对于<html:text/>这样的东西可以可视化编辑,如可以对STRUTS的TEXT随意拖放位置,有没有这种插件(要免费的)
- 部署EJB时候出的问题
- java在线程中通过hibernate循环去操作数据库,不停的进行事务的处理和session的创建和关闭,会对系统造成什么影响
- ssh 报java.lang.NullPointerException 错误
- redis问题
- spring+hibernate事务不起作用,为什么?
- java 内存地址 通过 jni 能获得到吗 在线等 100分
//---------------------------------------------------------------------
// Implementation of Lifecycle interface
//--------------------------------------------------------------------- public void start() {
Map lifecycleBeans = getLifecycleBeans();
for (Iterator it = new LinkedHashSet(lifecycleBeans.keySet()).iterator(); it.hasNext();) {
String beanName = (String) it.next();
doStart(lifecycleBeans, beanName);
}
publishEvent(new ContextStartedEvent(this));
} /**
* Start the specified bean as part of the given set of Lifecycle beans,
* making sure that any beans that it depends on are started first.
* @param lifecycleBeans Map with bean name as key and Lifecycle instance as value
* @param beanName the name of the bean to start
*/
private void doStart(Map lifecycleBeans, String beanName) {
Lifecycle bean = (Lifecycle) lifecycleBeans.get(beanName);
if (bean != null) {
String[] dependenciesForBean = getBeanFactory().getDependenciesForBean(beanName);
for (int i = 0; i < dependenciesForBean.length; i++) {
doStart(lifecycleBeans, dependenciesForBean[i]);
}
if (!bean.isRunning()) {
bean.start();
}
lifecycleBeans.remove(beanName);
}
}注意里面有一个递归。。开始生命周期。。