|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2014 the original author or authors. |
| 2 | + * Copyright 2002-2015 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -483,7 +483,10 @@ public void refresh() throws BeansException, IllegalStateException {
|
483 | 483 | }
|
484 | 484 |
|
485 | 485 | catch (BeansException ex) {
|
486 |
| - logger.warn("Exception encountered during context initialization - cancelling refresh attempt", ex); |
| 486 | + if (logger.isWarnEnabled()) { |
| 487 | + logger.warn("Exception encountered during context initialization - " + |
| 488 | + "cancelling refresh attempt: " + ex); |
| 489 | + } |
487 | 490 |
|
488 | 491 | // Destroy already created singletons to avoid dangling resources.
|
489 | 492 | destroyBeans();
|
@@ -884,11 +887,12 @@ protected void registerListeners() {
|
884 | 887 | for (ApplicationListener<?> listener : getApplicationListeners()) {
|
885 | 888 | getApplicationEventMulticaster().addApplicationListener(listener);
|
886 | 889 | }
|
| 890 | + |
887 | 891 | // Do not initialize FactoryBeans here: We need to leave all regular beans
|
888 | 892 | // uninitialized to let post-processors apply to them!
|
889 | 893 | String[] listenerBeanNames = getBeanNamesForType(ApplicationListener.class, true, false);
|
890 |
| - for (String lisName : listenerBeanNames) { |
891 |
| - getApplicationEventMulticaster().addApplicationListenerBean(lisName); |
| 894 | + for (String listenerBeanName : listenerBeanNames) { |
| 895 | + getApplicationEventMulticaster().addApplicationListenerBean(listenerBeanName); |
892 | 896 | }
|
893 | 897 | }
|
894 | 898 |
|
@@ -1287,7 +1291,7 @@ public void stop() {
|
1287 | 1291 | }
|
1288 | 1292 |
|
1289 | 1293 | public boolean isRunning() {
|
1290 |
| - return getLifecycleProcessor().isRunning(); |
| 1294 | + return (this.lifecycleProcessor != null && this.lifecycleProcessor.isRunning()); |
1291 | 1295 | }
|
1292 | 1296 |
|
1293 | 1297 |
|
|
0 commit comments