From 9508f41a91782afec3f88cdbd87aad3f4b8d6a13 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 23 Sep 2009 21:17:30 +0000 Subject: [PATCH] made InitDestroyAnnotationBeanPostProcessor's logger field transient (SPR-5962) --- ...nitDestroyAnnotationBeanPostProcessor.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java index 33ddaa8d2a..b8adac7e68 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java @@ -16,6 +16,8 @@ package org.springframework.beans.factory.annotation; +import java.io.IOException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; @@ -66,13 +68,11 @@ import org.springframework.util.ReflectionUtils; * @since 2.5 * @see #setInitAnnotationType * @see #setDestroyAnnotationType - * @see org.springframework.context.annotation.CommonAnnotationBeanPostProcessor */ public class InitDestroyAnnotationBeanPostProcessor implements DestructionAwareBeanPostProcessor, MergedBeanDefinitionPostProcessor, PriorityOrdered, Serializable { - /** Logger available to subclasses */ - protected final Log logger = LogFactory.getLog(getClass()); + protected transient Log logger = LogFactory.getLog(getClass()); private Class initAnnotationType; @@ -224,6 +224,19 @@ public class InitDestroyAnnotationBeanPostProcessor } + //--------------------------------------------------------------------- + // Serialization support + //--------------------------------------------------------------------- + + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + // Rely on default serialization; just initialize state after deserialization. + ois.defaultReadObject(); + + // Initialize transient fields. + this.logger = LogFactory.getLog(getClass()); + } + + /** * Class representing information about annotated init and destroy methods. */