Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templateEngine cause spring boot shutting down #214

Open
fengb4676 opened this issue Apr 18, 2019 · 0 comments
Open

templateEngine cause spring boot shutting down #214

fengb4676 opened this issue Apr 18, 2019 · 0 comments

Comments

@fengb4676
Copy link

thymeleaf 3.0.1
spring boot: 2.1.3

i was use thymeleaf templateEngine to create static html file when user visit the page。

when i depoly to tomcat, found that when create some html file, the spring boot site will be shutting down and restart。

code like this:

        ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
        resolver.setPrefix("templates/");
        resolver.setSuffix(".html");
        TemplateEngine templateEngine = new TemplateEngine();
        templateEngine.setTemplateResolver(resolver);
        Context context = new Context();
        context.setVariables(mode.asMap());
        FileWriter writer = new FileWriter(saveFilePath);
        templateEngine.process(templateName, context, writer);

log like :

19:59:17.916 | INFO | Shutting down ExecutorService 'applicationTaskExecutor' | ThreadPoolTaskExecutor.shutdown(208) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:17.917 | INFO | DatebookHikariCP - Shutdown initiated... | HikariDataSource.close(350) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:17.928 | INFO | DatebookHikariCP - Shutdown completed. | HikariDataSource.close(352) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:20.969 | INFO | Starting ZxtSiteApplication on 10-79-15-173 with PID 22332 (/home/zskd_zxtsch_site/tomcat-8.0.30/webapps/zskd_zxtsch_site/WEB-INF/classes started by zskd_zxtsch_site in /home/zskd_zxtsch_site) | ZxtSiteApplication.logStarting(50) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:20.986 | INFO | No active profile set, falling back to default profiles: default | ZxtSiteApplication.logStartupProfileInfo(675) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:22.289 | INFO | Root WebApplicationContext: initialization completed in 1233 ms | ContextLoader.prepareWebApplicationContext(296) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:23.629 | INFO | Initializing ExecutorService 'applicationTaskExecutor' | ThreadPoolTaskExecutor.initialize(171) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:23.859 | INFO | Adding welcome page: class path resource [public/index.html] | WelcomePageHandlerMapping.(56) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:24.032 | INFO | Started ZxtSiteApplication in 3.775 seconds (JVM running for 90.971) | ZxtSiteApplication.logStarted(59) | ContainerBackgroundProcessor[StandardEngine[Catalina]] |
19:59:24.450 | INFO | Initializing Servlet 'dispatcherServlet' | DispatcherServlet.initServletBean(524) | http-nio-8002-exec-10 |
19:59:24.460 | INFO | Completed initialization in 10 ms | DispatcherServlet.initServletBean(546) | http-nio-8002-exec-10 |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant