|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2012 the original author or authors. |
| 2 | + * Copyright 2002-2013 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.
|
@@ -81,24 +81,32 @@ public List<Advisor> findAdvisorBeans() {
|
81 | 81 |
|
82 | 82 | List<Advisor> advisors = new LinkedList<Advisor>();
|
83 | 83 | for (String name : advisorNames) {
|
84 |
| - if (isEligibleBean(name) && !this.beanFactory.isCurrentlyInCreation(name)) { |
85 |
| - try { |
86 |
| - advisors.add(this.beanFactory.getBean(name, Advisor.class)); |
| 84 | + if (isEligibleBean(name)) { |
| 85 | + if (this.beanFactory.isCurrentlyInCreation(name)) { |
| 86 | + if (logger.isDebugEnabled()) { |
| 87 | + logger.debug("Skipping currently created advisor '" + name + "'"); |
| 88 | + } |
87 | 89 | }
|
88 |
| - catch (BeanCreationException ex) { |
89 |
| - Throwable rootCause = ex.getMostSpecificCause(); |
90 |
| - if (rootCause instanceof BeanCurrentlyInCreationException) { |
91 |
| - BeanCreationException bce = (BeanCreationException) rootCause; |
92 |
| - if (this.beanFactory.isCurrentlyInCreation(bce.getBeanName())) { |
93 |
| - if (logger.isDebugEnabled()) { |
94 |
| - logger.debug("Ignoring currently created advisor '" + name + "': " + ex.getMessage()); |
| 90 | + else { |
| 91 | + try { |
| 92 | + advisors.add(this.beanFactory.getBean(name, Advisor.class)); |
| 93 | + } |
| 94 | + catch (BeanCreationException ex) { |
| 95 | + Throwable rootCause = ex.getMostSpecificCause(); |
| 96 | + if (rootCause instanceof BeanCurrentlyInCreationException) { |
| 97 | + BeanCreationException bce = (BeanCreationException) rootCause; |
| 98 | + if (this.beanFactory.isCurrentlyInCreation(bce.getBeanName())) { |
| 99 | + if (logger.isDebugEnabled()) { |
| 100 | + logger.debug("Skipping advisor '" + name + |
| 101 | + "' with dependency on currently created bean: " + ex.getMessage()); |
| 102 | + } |
| 103 | + // Ignore: indicates a reference back to the bean we're trying to advise. |
| 104 | + // We want to find advisors other than the currently created bean itself. |
| 105 | + continue; |
95 | 106 | }
|
96 |
| - // Ignore: indicates a reference back to the bean we're trying to advise. |
97 |
| - // We want to find advisors other than the currently created bean itself. |
98 |
| - continue; |
99 | 107 | }
|
| 108 | + throw ex; |
100 | 109 | }
|
101 |
| - throw ex; |
102 | 110 | }
|
103 | 111 | }
|
104 | 112 | }
|
|
0 commit comments