Redeployment and Live Reload
During development, webforJ applies saved changes to the running app and updates the browser. Class changes reach the app through a hotswap tool or through a restart. Live reload updates the browser after either.
Projects created from an archetype come configured. For an existing project, follow Spring Boot or Jetty.
How each change applies
| Change | Result | Reference |
|---|---|---|
| Java class, hotswap tool attached | The class updates in the running app. The affected part of the page rebuilds and the app state stays. | Hotswap |
| Java class, no hotswap tool | The app restarts. The browser reloads when the app is ready. | Spring Boot, Jetty |
| Stylesheet or image | The page applies it in place, without a reload. | Settings |
Source under src/main/frontend | The watch rebuilds it and updates the browser. | Frontend watch |
Settings
These settings control live reload during development:
| Property | Default | Description |
|---|---|---|
webforj.devtools.livereload.enabled | false | Turns live reload on for development runs. |
webforj.devtools.livereload.websocket-port | 35730 | Port for the browser connection. |
webforj.devtools.livereload.websocket-path | /webforj-devtools-ws | Path for the browser connection. |
webforj.devtools.livereload.static-resources-enabled | true | Applies stylesheet and image changes in place instead of reloading the page. |
webforj.devtools.livereload.heartbeat-interval | 30000 | Interval in milliseconds for the connection checks that detect a restarting server. |
The keys have no effect in a packaged app. Packaged apps contain no development tools.
Topics
Hotswap
Apply compiled class changes to a running webforJ app without a restart, through HotswapAgent or JRebel configured in the webforJ build plugin.
Frontend watch
Rebuild the sources under src/main/frontend while a webforJ app runs, applying stylesheet and image output in place and reloading the view for script output.
Spring Boot
Set up live reload in a Spring Boot webforJ app, with the development tools delivered by the webforJ build plugin.
Jetty
Run a webforJ app on the embedded Jetty server with the Maven Jetty plugin, with live reload and hotswap during development.