We have a huge spring based monolith Java app that takes ~30 minutes to deploy. I recently found out the hotswap capabilities coming with the JDK quite helpful in development although it can only hotswap method body.
The official docs from oracle suggests below here
Organizations deploying long running servers wish to be able to fix bugs without taking down the server.
Is it recommended to do it in production?. What are the pros and cons of it?
Don't.
Pro: No deploymemt time.
Con: Never, NEVER do a hot swap on a production system. Only if you are 100% sure about everything, but no one is 100% sure. I would recommend to never practice this task. Saved time isn't worth more than safety. What if your code has side effects you so not know?
Please don't.
Fix the bugs and then create a release.
Please Take a look at this Image: https://rapidbi.com/wp-content/uploads/2017/03/Project-management-triangle.png.webp You can only pull in TWO sides of the triangle.
Kind regards