package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan
@EnableAutoConfiguration
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

@@ -24,247 +24,1797 @@
 org.
-springframework.boot.SpringApplication;%0Aimport org.springframework.boot.autoconfigure.EnableAutoConfiguration;%0Aimport org.springframework.context.annotation.ComponentScan;%0A%0A@ComponentScan%0A@EnableAutoConfiguration%0Apublic class Application %7B
+apache.catalina.session.FileStore;%0Aimport org.apache.catalina.session.PersistentManager;%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0Aimport org.springframework.boot.SpringApplication;%0Aimport org.springframework.boot.autoconfigure.EnableAutoConfiguration;%0Aimport org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;%0Aimport org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.ComponentScan;%0Aimport org.springframework.context.annotation.Configuration;%0A%0Aimport java.io.File;%0Aimport java.util.Arrays;%0A%0A@Configuration%0A@ComponentScan%0A@EnableAutoConfiguration%0Apublic class Application %7B%0A    private Log log = LogFactory.getLog(Application.class);%0A%0A    @Bean%0A    public EmbeddedServletContainerCustomizer containerCustomizer() %7B%0A        return factory -%3E %7B%0A            TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;%0A            containerFactory.setTomcatContextCustomizers(Arrays.asList(context -%3E %7B%0A                final PersistentManager persistentManager = new PersistentManager();%0A                final FileStore store = new FileStore();%0A%0A                final String sessionDirectory = makeSessionDirectory();%0A                log.info(%22Writing sessions to %22 + sessionDirectory);%0A                store.setDirectory(sessionDirectory);%0A%0A                persistentManager.setStore(store);%0A                context.setManager(persistentManager);%0A            %7D));%0A        %7D;%0A    %7D%0A%0A    private String makeSessionDirectory() %7B%0A        final String cwd = System.getProperty(%22user.dir%22);%0A        return cwd + File.separator + %22sessions%22;%0A    %7D
 %0A%0A  

Use persistent file based sessions that survive application restarts.