diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java index 85faab006b..ab473c3121 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/AbstractFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.FactoryBeanNotInitializedException; import org.springframework.beans.factory.InitializingBean; +import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.ReflectionUtils; @@ -153,7 +154,7 @@ public abstract class AbstractFactoryBean } /** - * Determine an 'eager singleton' instance, exposed in case of a + * Determine an 'early singleton' instance, exposed in case of a * circular reference. Not called in a non-circular scenario. */ @SuppressWarnings("unchecked") @@ -176,9 +177,7 @@ public abstract class AbstractFactoryBean * @throws IllegalStateException if the singleton instance is not initialized */ private T getSingletonInstance() throws IllegalStateException { - if (!this.initialized) { - throw new IllegalStateException("Singleton instance not initialized yet"); - } + Assert.state(this.initialized, "Singleton instance not initialized yet"); return this.singletonInstance; } @@ -218,7 +217,7 @@ public abstract class AbstractFactoryBean * FactoryBean is supposed to implement, for use with an 'early singleton * proxy' that will be exposed in case of a circular reference. *

The default implementation returns this FactoryBean's object type, - * provided that it is an interface, or {@code null} else. The latter + * provided that it is an interface, or {@code null} otherwise. The latter * indicates that early singleton access is not supported by this FactoryBean. * This will lead to a FactoryBeanNotInitializedException getting thrown. * @return the interfaces to use for 'early singletons', diff --git a/src/asciidoc/core-beans.adoc b/src/asciidoc/core-beans.adoc index a2b044842d..99c351cf35 100644 --- a/src/asciidoc/core-beans.adoc +++ b/src/asciidoc/core-beans.adoc @@ -8360,12 +8360,12 @@ simple class that extends Spring's `ApplicationEvent` base class: public class BlackListEvent extends ApplicationEvent { private final String address; - private final String test; + private final String content; - public BlackListEvent(Object source, String address, String test) { + public BlackListEvent(Object source, String address, String content) { super(source); this.address = address; - this.test = test; + this.content = content; } // accessor and other methods... @@ -8393,10 +8393,9 @@ example demonstrates such a class: this.publisher = publisher; } - public void sendEmail(String address, String text) { + public void sendEmail(String address, String content) { if (blackList.contains(address)) { - BlackListEvent event = new BlackListEvent(this, address, text); - publisher.publishEvent(event); + publisher.publishEvent(new BlackListEvent(this, address, content)); return; } // send email...