重新部署与实时重载
在开发过程中,webforJ 将保存的更改应用于正在运行的应用程序并更新浏览器。类更改通过 hotswap 工具 或通过重启应用到达应用程序。无论使用哪种方式,实时重载都会在之后更新浏览器。
从 archetype 创建的项目是预先配置的。对于现有项目,请遵循 Spring Boot、Jetty 或 BBjServices。
每个更改的应用方式
| 更改 | 结果 | 参考 |
|---|---|---|
| Java 类,附加 hotswap 工具 | 类在运 行的应用中更新。受影响的页面部分重建,应用状态保持不变。 | Hotswap |
| Java 类,没有 hotswap 工具 | 应用重启。当应用准备好时,浏览器重新加载。 | Spring Boot、Jetty |
| Java 类在 BBjServices 中,没有 hotswap 工具 | 更改在监视重新启动之前不会应用。 | BBjServices |
| 样式表或图像 | 页面即时应用,而无需重新加载。 | 设置 |
src/main/frontend 下的源代码 | 监视重建它并更新浏览器。 | 前端监视 |
设置
这些设置控制开发过程中的实时重载:
| 属性 | 默认值 | 描述 |
|---|---|---|
webforj.devtools.livereload.enabled | false | 开启开发运行的实时重载。 |
webforj.devtools.livereload.websocket-port | 35730 | 浏览器连接的端口。 |
webforj.devtools.livereload.websocket-path | /webforj-devtools-ws | 浏览器连接的路径。 |
webforj.devtools.livereload.static-resources-enabled | true | 即时应用样式表和图像更改,而不是重新加载页面。 |
webforj.devtools.livereload.heartbeat-interval | 30000 | 检测重启服务器的连接检查的间隔(以毫秒为单位)。 |
这些键在打包应用中没有效果。打包应用不包含开发工具。
主题
热替换
Apply compiled class changes to a running webforJ app without a restart, through HotswapAgent or JRebel configured in the webforJ build plugin.
前端监听
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.
BBjServices
Set up live reload and hotswap for a webforJ app that runs in the BBjServices of your own machine through BBjShip.
