Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat/Spring boot reloading META-INF/resources/ jsp files (live updates)

I have a problem using jsp in spring boot/tomcat instances. Basically, I have all jsp files inside module A (A/src/main/resources/META-INF/resources/jsp) and this module is included into module B (main module, war packaging) as a jar dependency. The problem is, when app is running in debug mode (either in Eclipse or in IntelliJ Idea), none of the jsp files located in module A, are being auto reloaded(changes in file are not seen on the rendered webpage), only restart of tomcat actually reloads the files and shows the changes. The overriden jsp files in Module B are being reloaded themselves, just the jsp files in Module A are having problems(probably because of META-INF/resources folder).

Module A structure(dependency, packaged as jar): src/main/resources/META-INF/resources/jsp/*.jsp

Module B structure(main module, packaged as war, jsp in here override the ones in Module A): src/main/webapp/jsp/*.jsp

I have searched for a solution to this, but the closest I came to an answer was this(Using JRebel): https://zeroturnaround.com/forums/topic/jsps-in-servlet-3-0-jars-are-not-reloading/

Also, this is an example on how I have jsp set up: https://github.com/ghillert/spring-boot-jsp-demo

like image 936
n00b Avatar asked Jan 11 '17 18:01

n00b


Video Answer


2 Answers

This is highly likely the same as: https://stackoverflow.com/a/8656527/696632

All resources in classpath are subject to a cache. You should evaluate the answer.

like image 166
Michael-O Avatar answered Oct 21 '22 07:10

Michael-O


I don't know if it fits your constraints but there is a solution like this out there : https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3

Another option: https://github.com/spring-projects/spring-loaded

I use JSF and Facelets and hot reload is always a bit problematic for web technologies which has dynamic rendering. So my suggestion apart from spring-boot-devtools will be separating static content development process from rendering related process. If you only need hot reload for css, html, js editing than most of technologies out there will help you but rendering related component editing going to ask you to rebuilt redeploy your app time to time. How frequently they going to ask you that depends on quality of the tool you will be using.

like image 35
Ebuzer Taha KANAT Avatar answered Oct 21 '22 05:10

Ebuzer Taha KANAT