1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2018 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.
33
33
import org .springframework .beans .factory .FactoryBean ;
34
34
import org .springframework .beans .factory .FactoryBeanNotInitializedException ;
35
35
import org .springframework .beans .factory .InitializingBean ;
36
+ import org .springframework .util .Assert ;
36
37
import org .springframework .util .ClassUtils ;
37
38
import org .springframework .util .ObjectUtils ;
38
39
import org .springframework .util .ReflectionUtils ;
@@ -153,7 +154,7 @@ public final T getObject() throws Exception {
153
154
}
154
155
155
156
/**
156
- * Determine an 'eager singleton' instance, exposed in case of a
157
+ * Determine an 'early singleton' instance, exposed in case of a
157
158
* circular reference. Not called in a non-circular scenario.
158
159
*/
159
160
@ SuppressWarnings ("unchecked" )
@@ -176,9 +177,7 @@ private T getEarlySingletonInstance() throws Exception {
176
177
* @throws IllegalStateException if the singleton instance is not initialized
177
178
*/
178
179
private T getSingletonInstance () throws IllegalStateException {
179
- if (!this .initialized ) {
180
- throw new IllegalStateException ("Singleton instance not initialized yet" );
181
- }
180
+ Assert .state (this .initialized , "Singleton instance not initialized yet" );
182
181
return this .singletonInstance ;
183
182
}
184
183
@@ -218,7 +217,7 @@ public void destroy() throws Exception {
218
217
* FactoryBean is supposed to implement, for use with an 'early singleton
219
218
* proxy' that will be exposed in case of a circular reference.
220
219
* <p>The default implementation returns this FactoryBean's object type,
221
- * provided that it is an interface, or {@code null} else . The latter
220
+ * provided that it is an interface, or {@code null} otherwise . The latter
222
221
* indicates that early singleton access is not supported by this FactoryBean.
223
222
* This will lead to a FactoryBeanNotInitializedException getting thrown.
224
223
* @return the interfaces to use for 'early singletons',
0 commit comments