Spring Boot
In a Spring Boot app, the webforJ build plugin delivers the development tools to development runs. The project declares no dependency for them, and they're never part of the packaged app.
Requirements
The starter dependency and the build plugin. A project created from an archetype has both.
- Maven
- Gradle
<dependency>
<groupId>com.webforj</groupId>
<artifactId>webforj-spring-boot-starter</artifactId>
</dependency>
<plugin>
<groupId>com.webforj</groupId>
<artifactId>webforj-maven-plugin</artifactId>
<version>${webforj.version}</version>
<extensions>true</extensions>
</plugin>
dependencies {
implementation 'com.webforj:webforj-spring-boot-starter'
}
with the webforJ plugin applied to the build.
Turning live reload on
webforj.devtools.livereload.enabled=true
server.shutdown=immediate
Start the app as usual, mvn with Maven or ./gradlew bootRun with Gradle. Java changes apply after a compile, stylesheet and image changes apply in place, and sources under src/main/frontend rebuild through the frontend watch. The remaining keys are listed in the settings.
Spring DevTools
Spring DevTools is optional, live reload works without it. To use its restart model, add its dependency:
- Maven
- Gradle
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
dependencies {
developmentOnly 'org.springframework.boot:spring-boot-devtools'
}
With Spring DevTools present, a compiled change restarts the Spring context and the browser refreshes when the restart completes. With a hotswap tool configured as well, the tool applies the class updates and the restart stays off.
Production builds
mvn package and ./gradlew bootJar produce an app without development tools, with no exclusion, profile, or property required. The webforj.devtools.livereload.enabled property has no effect in a packaged app.