From 203b6f2f2c8c51cc41d2a44cef5f28a86fb456b4 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Wed, 23 Nov 2016 16:04:36 +0100 Subject: [PATCH] Fix undertow session persistence with spring-boot-devtools Fixes gh-7460 --- .../embedded/undertow/FileSessionPersistence.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java index acd4ee4225..e8a6007e3b 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java @@ -30,6 +30,8 @@ import java.util.Map; import io.undertow.servlet.UndertowServletLogger; import io.undertow.servlet.api.SessionPersistenceManager; +import org.springframework.core.ConfigurableObjectInputStream; + /** * {@link SessionPersistenceManager} that stores session information in a file. * @@ -82,7 +84,7 @@ public class FileSessionPersistence implements SessionPersistenceManager { try { File file = getSessionFile(deploymentName); if (file.exists()) { - return load(file); + return load(file, classLoader); } } catch (Exception ex) { @@ -91,9 +93,10 @@ public class FileSessionPersistence implements SessionPersistenceManager { return null; } - private Map load(File file) + private Map load(File file, ClassLoader classLoader) throws IOException, ClassNotFoundException { - ObjectInputStream stream = new ObjectInputStream(new FileInputStream(file)); + ObjectInputStream stream = new ConfigurableObjectInputStream( + new FileInputStream(file), classLoader); try { return load(stream); }