diff --git a/org.springframework.aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java b/org.springframework.aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java index 6ce2bca6ec..83c8083e5b 100644 --- a/org.springframework.aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java +++ b/org.springframework.aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2011 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. @@ -16,7 +16,9 @@ package org.springframework.aop.target; +import java.io.IOException; import java.io.NotSerializableException; +import java.io.ObjectInputStream; import java.io.ObjectStreamException; import org.springframework.beans.BeansException; @@ -91,6 +93,11 @@ public abstract class AbstractPrototypeBasedTargetSource extends AbstractBeanFac // Serialization support //--------------------------------------------------------------------- + private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { + throw new NotSerializableException("A prototype-based TargetSource itself is not deserializable - " + + "just a disconnected SingletonTargetSource is"); + } + /** * Replaces this object with a SingletonTargetSource on serialization. * Protected as otherwise it won't be invoked for subclasses.