diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java index 38f2f85103..6fdd307dd5 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java @@ -221,6 +221,7 @@ public class JettyEmbeddedServletContainerFactory extends protected final void configureWebAppContext(WebAppContext context, ServletContextInitializer... initializers) { Assert.notNull(context, "Context must not be null"); + context.setTempDirectory(getTempDirectory()); setExtendedListenerTypes(context); if (this.resourceLoader != null) { context.setClassLoader(this.resourceLoader.getClassLoader()); @@ -246,6 +247,11 @@ public class JettyEmbeddedServletContainerFactory extends postProcessWebAppContext(context); } + private File getTempDirectory() { + String temp = System.getProperty("java.io.tmpdir"); + return (temp == null ? null : new File(temp)); + } + private void setExtendedListenerTypes(WebAppContext context) { try { context.getServletContext().setExtendedListenerTypes(true);