I would like to ask about the experience of a production run of a Spring Boot web application, with embeded Tomcat, based on Maven or Gradle. So far I have been working with a vanilla Spring application, deployed on Tomcat, without dependencies manager, with all external jars collected in /WEB-INF/lib/
.
I have a typical web application, which is primarily a multi-user web service, and which changes very often. I often change something in views (JSP files in my case), in Java classes, and in Javascript or CSS files.
I don’t want to generate a new .jar file with each update, upload it to the server, and restart the application. I would like to work on the unpacked files and replace only the ones that have changed.
I can run the application in “debug” mode so that simple changes to classes will automatically load. And with changes to the external libraries (dependencies) used in my app, of course I can “reload” the application, but I’d like this to happen as quickly as possible and with the least impact on users.
How do I organize the process of updating the application on the server?
I assume that on the server I can execute, for example, an application update from SVN or GIT repository, and I can execute a Maven or Gradle script there. I would like the update to be as fast as possible, for example:
- “git pull” of Java sources, views and static files
- update external libraries from dependencies, eventually download new jar files and remove unused ones.
- compile new classes on server
- only if necessary – reload the application
Or maybe for such needs, the model of a Spring Boot application deployed on Tomcat, rather than with Tomcat embedding, is better? What are your experiences?
And the second question: in the application deployed on Tomcat, I used the convenient function of reloading the application with Tomcat Manager. This is a very fast operation, much faster than restarting the whole application. In addition, it allows you to serializate and restore all sessions.
Is such a “reload” possible in Spring Boot with embeded Tomcat?