-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Reload current page upon code changes with Livereload #19
Comments
I see this for traditional server side rendered applications but I am not sure how this could be solved for SPA projects. I think usually the frontend code is in the separate git repository. And if it is not, how Just would know what to run and when to run? Suggestions are welcome :-) Also if you have a sample repo somewhere with the setup you have in mind I am happy to take a look. |
I was specifically thinking about server-side rendering; Thymeleaf, in particular. Like you said, for SPA front-ends that feature is pretty much covered already, for server-side rendering live reloading support for Java applications for the most part is still lacking or involves awkward workarounds with browser extensions.
Sure. Using Wim Deblauwe's Taming Thymeleaf CLI (which is amazing in its own right, by the way) I've created a sample project which shows the behaviour I have in mind (the README.md file contains the required steps for launching the application in live reload mode): https://github.com/BjoernKW/thymeleaf-live-reloading-demo In a nutshell, |
Thanks a lot! If I understand it right - it essentially means having live reload of static resources/templates without installing an extension http://livereload.com/extensions/ ..? |
Yes, that's it exactly! This makes the project's development setup self-contained and the project ready to be used out-of-the-box. |
Besides, with the last update having been made 7 years ago, LiveReload Browser Extensions probably is hopelessly outdated. Their website isn't even available anymore, which really has me wonder why it's still mentioned as a viable solution in the current Spring Boot documentation (https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.devtools.livereload), but that's another matter and one Spring Boot core developers probably should have a look at ;-) Edit: See this issue spring-projects/spring-boot#32111 |
Thanks @BjoernKW! Got it working in Just 🚀 |
Because of the dependency on servlet related classes I will make it work for Spring Boot 3.0+ |
Managed to get it working for both Spring Boot 2.7+ and 3.0+. Only refreshing part. I am not sure if opening browser is the right way to go. |
If the Spring Boot application started via
just run
is a web application (or, more specifically: a web application providing HTML views), Just could launch the default browser with the web application's home page (usuallyhttp://localhost:8080
) and reload the current page in the browser upon code changes.While the former (launching a browser from the command line) probably is rather easy, the latter (i.e. live reloading changes) would require a more sophisticated approach, like the live reload servers provided by web frameworks such as Angular or React.
The text was updated successfully, but these errors were encountered: