Docs

Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

Live Reload

Live Reload means automatically reloading the application in the browser after modifying its code, instead of manually restarting the server and refreshing the browser page.

In Vaadin projects, Live Reload is supported out of the box for frontend code changes, and for Java changes in Spring Boot projects. For the latter, it also integrates with popular third-party Java hotpatching tools.

Frontend Changes

Code in the application’s frontend folder (JS/TS/CSS files) is monitored by webpack-dev-server when running the application in development mode. Adding, modifying or removing a file in this folder triggers recompilation of the frontend bundle and subsequent a browser reload.

Java Changes

On the Java side, Live Reload means first compiling the modified code, then updating the running server (either by restarting it, or by hotpatching the runtime), and finally refreshing the browser. Live Reload can use Spring Boot Developer Tools automatic server restart feature (enabled by default in Spring Boot-based Vaadin applications), as well as two hotpatching tools: JRebel (commercial, for all Vaadin applications) and HotswapAgent (open-source, for all Vaadin applications). See the below sections for details on setting up the chosen technology:

Note that only one of these technologies should be configured in the project at a time to avoid interference. In general, hotpatching is faster than automatic restarts and works best for small, incremental changes. Larger changes, such as class level modifications or changes to code that affect the whole application lifecycle (startup, shutdown, mapping between frontend and backend components), usually necessitate a server restart regardless.

Automatic Server Restart

As an alternative to Live Reload, the Jetty and TomEE Maven plugins facilitate automatic server restart on Java changes. These do not require installing third-party tools, but have the disadvantage that server restarts are slower and the browser will not refresh automatically.