What's new in version 25.03?
webforJ version 25.03
introduces new capabilities for configuration management, Spring integration options, routing improvements, and Table
component updates.
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 🎉
Early lifecycle hooks for configuration management
webforJ 25.03
introduces onWillCreate
and onDidCreate
lifecycle hooks that give control over app initialization. These new hooks fire at critical moments during startup – onWillCreate
executes before your app instance is created, while onDidCreate
runs immediately after creation but before serving requests.
These additions solve a common challenge in enterprise applications: performing operations like validating environment variables, configuring logging systems, or establishing database connections at exactly the right moment during startup. With these hooks, you can now modify configuration before it locks, validate prerequisites, and set up resources your app depends on.
For implementation details, see the Lifecycle Listeners documentation.
Spring properties file configuration support
Configuration with Spring Boot has seen improvements in 25.03
. Configure your webforJ applications directly in application.properties
or application.yml
files using the webforj.*
prefix – from servlet mappings and debug settings to file upload limits and custom servlet registration.
The system respects Spring Boot's configuration hierarchy, so properties from environment variables, command-line arguments, and external configuration sources all work as expected.
Moving from webforj.conf
to Spring properties? Both approaches work side-by-side during migration. Spring properties take precedence when both are present, allowing for gradual transition.
For configuration examples and details, see the Spring Integration documentation.
Spring MVC coexistence at root path
webforJ 25.03
enables seamless integration with Spring MVC when deployed at the root path ("/"). This solves a challenge where webforJ's servlet registration at root would conflict with Spring's DispatcherServlet, preventing the use of REST endpoints and Spring MVC controllers alongside webforJ routes.
The new integration approach registers the webforJ servlet at an internal path and forwards requests through Spring MVC's handler chain. This maintains full compatibility with Spring features like filters, interceptors, and other handler mappings while preserving webforJ's routing capabilities. Now you can build hybrid applications that leverage both Spring MVC REST endpoints for APIs and webforJ routes for rich UI components.
When webforJ is mapped to the root context, you can exclude specific URL patterns from webforJ handling using the webforj.exclude-urls
property. This allows Spring MVC controllers to handle paths like /api/**
for REST endpoints or /actuator/**
for Spring Boot actuator endpoints, while webforJ handles all other routes.
Spring custom scopes for webforJ environments and routes
Version 25.03
introduces three powerful Spring scope annotations designed specifically for component-based architectures: @WebforjSessionScope
, @EnvironmentScope
and @RouteScope
. These new scopes align bean lifecycles with webforJ's runtime model, ensuring beans exist exactly as long as they're needed.
@WebforjSessionScope
creates beans that persist across the entire webforJ session, shared across all browser tabs and windows from the same browser. Unlike environment-scoped beans which isolate state per tab, session-scoped beans maintain shared state for authentication, user preferences, and shopping carts. When a user logs in through one tab, all other tabs immediately have access to the authenticated state.
@EnvironmentScope
ties beans to individual browser windows or tabs – each tab gets its own isolated instance, ideal for tab-specific state that shouldn't be shared across windows. Beans remain available throughout the entire tab session, perfect for maintaining UI state, user preferences, or cached data specific to that browser context.
@RouteScope
binds beans to route hierarchies, where parent and child routes share instances but navigating to different route trees creates fresh beans. This scope is particularly useful for managing state within multi-step workflows or nested route structures, ensuring data consistency within a route context while providing clean separation between different application areas. For finer control, the @SharedFrom
annotation lets you customize scope boundaries, restricting bean availability to specific component subtrees and enforcing architectural boundaries with runtime validation.
Learn more about Spring integration and custom scopes in the Spring Framework integration documentation.
Table column sizing and moving support
The Table
has been enhanced in this release to introduce comprehensive column manipulation capabilities. Users can now drag column borders to resize, and drag headers to reorder their respective columns.
The new column management APIs offer both interactive and programmatic control. Set width constraints with setMinWidth()
and setMaxWidth()
, enable resizing with setResizable(true)
, allow reordering with setMovable(true)
, and implement flex sizing with setFlex()
for responsive layouts. Event listeners for resize and move operations enable preference persistence and custom state management.
These features are particularly valuable in data-heavy applications like financial dashboards and reporting tools, where different users need to arrange columns to match their workflow patterns.
Afficher le code
- Java
Visit the Columns article for more detailed implementation of columns inside a Table
.
SessionObjectTable for HTTP session-scoped storage
webforJ 25.03
introduces SessionObjectTable
, a new addition to the existing ObjectTable
and StringTable
utilities. While the original tables provide environment-scoped storage for shared data across your application, SessionObjectTable
brings HTTP session-scoped storage capabilities when running in Jakarta Servlet 6.1+ containers.
SessionObjectTable
lets devs manage user-specific state in servlet environments, storing serializable objects that persist across all browser tabs and windows for a single user session. It provides the same static API methods like put()
, get()
, contains()
, and clear()
, but with session-level persistence. This is useful for managing authentication state, user preferences, and features like shopping carts across multiple tabs.
This addition completes the storage hierarchy in webforJ, giving you the right scoping tool for every need: StringTable
for persistent configuration, ObjectTable
for environment-scoped data, and now SessionObjectTable
for true HTTP session management.
Learn more about data storage options in the Object and String Tables documentation.
Router Activate lifecycle event for cached components
Routing has had the ActivateEvent
and ActivateObserver
interfaces added to handle component reactivation. When users navigate back to a cached component, the onActivate()
method fires, allowing you to refresh data while preserving component state – developers will no longer be forced to choose between recreating entire components or manually checking for changes.
This feature shines in parameter-driven routes. Navigate from /customer/123
to /customer/456
, and the component stays cached while onActivate
provides an opportunity to load new customer data. User inputs, form state, and expensive initializations all persist, while only the relevant data refreshes.
Automatic browser launch for Spring Boot development
Finally, a little quality of life enhancement for developers - automatic browser launch has been added in webforJ 25.03
. When running Spring Boot applications in development mode, webforJ can now automatically open your default browser to the application URL, removing the need to manually type localhost addresses.
Configure this feature through simple application properties: enable it with webforj.devtools.browser.open=true
and choose your preferred host resolution with webforj.devtools.browser.host
. Whether you prefer localhost
, your machine's hostname, or a specific IP address for remote access testing, the browser launcher can be configured for your development setup.
Upgrade notes
When upgrading to 25.03
, be aware of the following:
- Spring Boot projects can now use the new configuration and scoping features
- Existing lifecycle hooks remain compatible with the new early lifecycle system
- Table components automatically support the new column features without code changes
25.03
strengthens the webforJ's enterprise offerings with improved Spring integration and component behavior. We're excited to see what you build with these new features!