What's new in version 25.02?
webforJ version 25.02
is here! This release introduces integration with popular tools to keep your apps running as efficiently as possible. Top on the list is exciting new integration capabilities with Spring Boot.
25.02
also builds on data management with Repository
improvements, introduces better control over app lifecycle with listener support, and streamlines asynchronous UI updates with the new runLater
API.
As always, see the GitHub release overview for a more comprehensive list of changes. Highlighted below are some of the most exciting changes:
New features and enhancements ๐โ
Spring Boot integrationโ
The first exciting change in 25.02
introduces Spring Boot integration, bringing together webforJ's UI components and Spring's backend ecosystem. This integration enables developers to use Spring's dependency injection, service layer, and data management while building modern web UIs with webforJ.
For enterprise teams with existing Spring Boot infrastructure, this release provides a path to modernize UI layers while maintaining current backend systems and development patterns.
You can go to the Spring Framework atricles for more in-depth information about Spring Boot integration.
Key featuresโ
- Dependency injection: Autowire Spring beans directly into webforJ views and components
- Spring Data integration: Use
SpringDataRepository
to connect UI components to your data layer - Hot reload support: Automatic browser refresh with Spring DevTools
- Familiar development: Continue using Spring annotations like
@Service
,@Repository
, and@Component
- Configuration flexibility: Combine
application.properties
withwebforj.conf
for complete control
Getting startedโ
Creating a new Spring Boot webforJ project is straightforward:
- Use startforJ: Visit startforJ and select webforJ + Spring Boot as your Flavor.
- Use Maven archetype: Generate a project from the command line using the official webforJ archetypes:
mvn -B archetype:generate \
-DarchetypeGroupId=com.webforj \
-DarchetypeArtifactId=webforj-archetype-hello-world \
-DarchetypeVersion=LATEST \
-DgroupId=org.example \
-DartifactId=my-app \
-Dversion=1.0-SNAPSHOT \
-Dflavor=webforj-spring
For existing projects, add the @SpringBootApplication
annotation to your main class alongside your existing webforJ configuration.
Dependenciesโ
Adding Spring Boot to your webforJ project requires just one starter dependency: webforj-spring-boot-starter
. This starter automatically includes all necessary webforJ and Spring Boot dependencies, simplifying dependency management.
<dependency>
<groupId>com.webforj</groupId>
<artifactId>webforj-spring-boot-starter</artifactId>
<version>${webforj.version}</version>
</dependency>
Developer productivity with Spring DevToolsโ
Gain access to several Spring DevTools when you integrate with Spring Boot:
- Automatic restart: Your app automatically restarts when you make code changes
- LiveReload support: Browser automatically refreshes when static resources change
- Fast app restarts: Only modified classes are reloaded
- Development-time optimizations: Caching is disabled and other settings are tuned for faster feedback
To enable DevTools, simply include it in your development dependencies for instant feedback on your changes.
Repository data managementโ
The Repository
pattern in webforJ 25.02
has been built on to improve data management and integration. This update introduces the DelegatingRepository
class, added event handling, and improved querying features that simplify working with external data sources.
What's new?โ
DelegatingRepository for custom data sources
The new DelegatingRepository
class streamlines integration with external data sources by requiring only three core functions: find
, count
, and findByKey
. This approach eliminates the complexity of implementing full repository interfaces while maintaining flexibility.
Repository
events now provide granular control over data changes, allowing you to react to single-entity or bulk updates with detailed change information. This enables building reactive UIs that automatically respond to data modifications.
Improved querying and filtering
The Repository
query system offers better versatility, with support for base filters that apply to all queries, combinations of multiple filter criteria, and smooth interaction with UI components like tables and lists.
Practical benefitsโ
These changes make the Repository
pattern more powerful and adaptable, enabling integration with REST APIs, databases, or any custom data source while maintaining a consistent, reactive programming model throughout your webforJ apps.
The Repository articles explain the Repository
and data management in more depth.
App lifecycle listenersโ
webforJ 25.02
introduces the AppLifecycleListener
interface, giving developers powerful hooks into critical app phases. This feature opens up new possibilities for initialization tasks, resource cleanup, and plugin architecture development.
How it worksโ
The AppLifecycleListener
interface provides four key methods that correspond to different stages of your app's lifecycle. These methods are called automatically as your app starts up and shuts down, giving you precise control over when your code executes.
The lifecycle begins with onWillRun()
, which fires just before your app starts running, followed by onDidRun()
after successful startup. When your app terminates, onWillTerminate()
provides a chance to clean up resources before the final onDidTerminate()
call.
Key featuresโ
- Automatic discovery: Listeners are automatically discovered at runtime through service provider configuration
- Isolated execution: Each app instance maintains its own set of listeners for proper isolation
- Priority control: Use
@AppListenerPriority
to control execution order when multiple listeners are present
Real-world appsโ
This feature enables various cross-cutting concerns that are essential for production apps. Database connection pools can be initialized and cleaned up gracefully, while logging and monitoring systems can be configured at startup. Cache warming, plugin system initialization, and comprehensive resource management all become straightforward with lifecycle listeners.
Registration is simple through service provider configuration files or the @AutoService
annotation for automatic discovery, making it easy to integrate into existing development workflows.
Asynchronous updates Experimentalโ
webforJ 25.02
introduces the experimental Environment.runLater()
API, bridging the gap between background processing and UI updates. This feature enables utilization of long-running operations while maintaining UI responsiveness and thread safety.
The challengeโ
webforJ enforces a single-threaded UI model where all component updates must occur on the Environment
thread. This design prevents race conditions and keeps the UI consistent, but it creates challenges when integrating asynchronous operations like API calls, file processing, or database queries.
The solutionโ
The runLater
API provides a thread-safe way to queue UI modifications from any background thread. When called from background threads, tasks are queued for execution on the UI thread. When called from the UI thread itself, tasks execute immediately without queuing overhead, providing optimal performance.
Key capabilitiesโ
- Thread-safe UI updates: Queue UI modifications from any background thread with automatic context inheritance
- Intelligent execution: Synchronous execution from UI thread, queued execution from background threads
- Task management: Cancel pending updates to prevent memory leaks and outdated UI changes
- Ordered execution: All queued tasks execute in strict FIFO order
For comprehensive implementation examples and best practices, see the asynchronous updates documentation.
As always, see the GitHub release overview for a more comprehensive list of changes.