Repository navigation
Vaadin Flow 25.4.0-beta1
Pre-releaseOverview
What changed in 25.4, in plain words:
- Vaadin apps can run under a strict Content Security Policy. A strict policy tells the browser to run only the scripts the server vouched for, which closes the door on most script injection attacks. Until now Vaadin needed the browser to compile JavaScript from text, which such a policy forbids. Flow now ships its own JavaScript in the bundle instead, sends the policy for you, and has a
warnmode that lists every place in your own code that still needs fixing before you switch it on. - Calling JavaScript from Flow is clearer and easier with a new API. Until now you passed JavaScript to the browser as a text string: the compiler could not check it, the same snippet was copied around the code, and the result came back as raw JSON that you had to convert yourself. Now you declare the JavaScript once, in a Java interface, and call it like any Java method — with real parameters, a name your IDE can find and a result that comes back already converted to the Java type you asked for. All the JavaScript an application uses lives in one visible place, the build puts it in the bundle, and the server only tells the browser which piece to run, which is also what makes it safe under a strict policy.
- Video and audio players in Java. New
VideoandAudiocomponents wrap the browser's own media players. The file can come straight from your application instead of a public URL, and users can skip forward in a video. - A real HTML form. A new
NativeFormcomponent is the plain<form>element that the browser submits on its own — for example a login form that password managers recognize, posting straight to Spring Security. - Any button can start a download or open a file in a new tab, with no link wrapped around it.
- Menus with levels. The automatic menu built from your views can now be a tree, so a side navigation can have groups that open and close.
- Applications can watch every request and navigation — when it started, how long it took, how it ended — and page scripts can time each round trip in the browser.
- Leaner and more predictable dependencies.
vaadin-springno longer chooses Spring MVC, Spring WebSocket and Hibernate Validator for you, Node.js 26 is the new minimum, and the Vaadin CDI add-on and Quarkus extension are now built and released together with Flow, under the same version. Plus the usual round of updated dependencies.
Breaking Changes
-
vaadin-springno longer brings Spring MVC, Spring WebSocket or Hibernate Validator to your classpath (#25927)The application now chooses its own Spring versions.
spring-webmvcisprovided, andspring-websocketandhibernate-validatorareoptional. The Vaadin Spring Boot starter still adds what it needs, so a typical Spring Boot application keeps working. A plain Spring application addsspring-webmvc,spring-boot-starter-websocketfor WebSocket push (without it push falls back to long polling, with a warning at startup) andspring-boot-starter-validationfor Bean Validation. -
Node.js 26 is the minimum (#25775)
A global Node.js older than 26 is ignored and Node.js 26 is downloaded into
~/.vaadininstead. On slim Linux images, the official Node.js 26 binaries needlibatomic1, which Node.js 24 did not. -
flow-serverno longer depends on gentyref (#26721)Generic types are resolved with plain JDK reflection. Code that used
com.vaadin.external:gentyrefthrough Flow has to declare it itself. -
Request handlers that run without a session (#26535)
The new
SessionlessRequestHandlerruns before any session is looked up, so a resource that is the same for every user no longer creates a session. Web component scripts and translation files are served this way now, so a customRequestHandlerthat served/web-component/*.jsorv-r=i18nno longer gets those requests, and theI18NProvideris called for translation files without aVaadinSession. -
MenuEntryhas a sixth component,children(#24556)Record patterns that list all components of
MenuEntryno longer compile. The 5-argument constructor is kept. -
The MPR push state constants are removed (#25854) —
UidlRequestHandler.PUSH_STATE_HASHandPUSH_STATE_LOCATIONare replaced by declared JavaScript.
Deprecations and Removals
-
String event data is deprecated (#26999)
DomListenerRegistration.addEventData(String)andaddEventDataElement(String)compile a JavaScript expression in the browser, which a strict Content Security Policy blocks. UseaddEventDataPath(String)andaddEventDataElementPath(String)for property paths such asevent.detail.itemKey, and declared JavaScript for anything else. -
@JsModulewith a runtime URL is deprecated (#24654)@JsModuleis for files that go into the bundle. A value such ascontext://,/abs/path.jsorhttps://…keeps working and loads at runtime, with a build warning that points to@JavaScript(value = ..., type = Type.MODULE). Note that@JsModule("/foo.js")on a component is now loaded from the context root at runtime rather than bundled from thefrontendfolder. -
The game on the PWA offline page is removed (#26557) — replaced by a redesigned default offline page (#26573).
New Features
Content Security Policy
-
cspmode setting:off,warnandstrict(#26157, #26661, #26660)warnlogs every call that would break under a strict policy —executeJswith a string, string event data,JsFunction.ofand the like — once per call site, with a stack trace leading to your code.strictmakes those calls throw aCspViolationException, and in production mode sends a nonce-basedContent-Security-Policyheader withscript-src 'nonce-…' 'strict-dynamic'and nounsafe-eval. The default staysoff, so nothing changes until you opt in.In a Spring Boot application, set it in
application.properties:# first find what still needs eval, then switch to strict vaadin.csp=warn
Without Spring, set the
cspservlet init parameter, or pass-Dvaadin.csp=warnto the JVM:@WebServlet(urlPatterns = "/*", asyncSupported = true, initParams = { @WebInitParam(name = "csp", value = "warn") }) public class AppServlet extends VaadinServlet { }
-
Flow's own JavaScript runs from the bundle (#25853, #25858, #26858, #26813) — focus, history, page title, clipboard, drag and drop, lazy chunk loading,
@EventData,@DomEventfilters, click counts and keyboard shortcuts no longer need the browser to compile JavaScript (#26845, #26889, #26952, #26953, #27000, #27023).
Declared JavaScript
-
Declare JavaScript in a Java interface and call it by method (#25749, #25799, #26890)
Mark an interface with
@JsDefinitionand its methods with@JsExpression. The build collects the JavaScript into the bundle, andElement.executeJs(Class)orPage.executeJs(Class)hands out an implementation whose methods schedule it, with the arguments as$0,$1, … and the element asthis. A method returningJavaScriptResult<T>gets its value already converted toT.@JsDefinition public interface ClipboardJs extends Serializable { @JsExpression("return navigator.clipboard.writeText($0).then(() => true, () => false);") JavaScriptResult<Boolean> copy(String text); } copyButton.addClickListener(e -> copyButton.getElement() .executeJs(ClipboardJs.class) .copy(order.getId()) .then(copied -> status.setText(copied ? "Copied" : "Copy failed")));
-
Event data as property paths (#26999, #26916) —
addEventDataPath("event.detail.itemKey")is read without compiling anything. -
Variadic methods (#25877), calling an element function without JavaScript text (#25852) and
JsFunctionvalues declared as bundled snippets (#26729).
Media, forms and HTML components
-
Video,AudioandSourcecomponents (#25900)The
<video>and<audio>elements withcontrols,autoplay,loop,muted,preloadand a videoposter. A source or poster can be aDownloadHandler, so the file is served by the application instead of a public URL. TestBench getsVideoElementandAudioElement.Video video = new Video(); video.setControlsVisible(true); video.setPreload(Media.Preload.METADATA); video.addSource(DownloadHandler.forFile(recordingFile), "video/mp4"); add(video);
-
Seeking and resumable downloads through HTTP range requests (#26198, #26255, #26340)
DownloadHandler.forFileanswers range requests, so a player can jump to any point and a broken download can resume. Class resources, servlet resources and input streams opt in withenableRangeRequests(). A warning is logged when a player asks for a range and the handler cannot answer it. -
NativeFormcomponent for the<form>element (#26807)A form that the browser submits itself, for posting to an endpoint outside Vaadin such as the Spring Security login URL. It posts with
POSTby default so passwords stay out of URLs, and an unsafeactionsuch asjavascript:is rejected.InputgetssetNameandsetAutocomplete, andNativeButtongetssetType.Input username = new Input(); username.setName("username"); username.setAutocomplete("username"); Input password = new Input(); password.setType("password"); password.setName("password"); password.setAutocomplete("current-password"); password.setValueChangeMode(null); // keep the password out of the session NativeButton submit = new NativeButton("Log in"); submit.setType(NativeButton.Type.SUBMIT); NativeForm form = new NativeForm(username, password, submit); form.setAction("login");
-
Theme plain HTML elements app-wide (#25809) —
vaadin.themed-html=truelets Aura and Lumo style native elements such as<table>; thevaadin-unthemed-htmlclass keeps one element out. -
RouterLink.setTarget(#26067) and anameattribute onNativeDetails(#26170).
Downloads and uploads
-
Start a download from any component (#26065, #27074)
Download.onClickmakes any component start a download when clicked, with noAnchoraround it.DownloadTarget.NEW_TABopens the content in a new tab instead, for example to show a PDF.Download.onClick(exportButton, reportHandler); // saved as a file Download.onClick(viewButton, invoiceHandler, DownloadTarget.NEW_TAB); // shown in a new tab
-
A UI stays alive while its uploads and downloads are running (#25431) — closing the tab no longer cuts off the completion callback, and an invalidated session ends its transfers.
-
Set the content type of a download handler (#26341), and a download handler is unregistered when the component that triggers it is removed (#26080).
Routing and navigation
-
Hierarchical menus (#24556)
MenuConfiguration.getMenuEntriesTree()returns the menu as a tree: views nest under their route parent, and@Menu(parent = ...)moves a view elsewhere in the menu only. The flat list works as before.for (MenuEntry entry : MenuConfiguration.getMenuEntriesTree()) { sideNav.addItem(toItem(entry)); // recurse into entry.children() }
-
Development-only routes (#26211) —
@Route(value = "debug", developmentOnly = true)is never registered in production, and its frontend stays out of the production bundle. -
RouteConfiguration.getUrl()withQueryParameters(#26062).
Request and navigation lifecycle
-
Request and navigation events on the service event bus (#25961, #25962, #25963, #25964, #25960)
RequestStartedEvent/RequestEndedEventandNavigationStartedEvent/NavigationEndedEventreport every request and navigation with its handler, outcome and duration. Session lock events now carry wait and hold time, and resent, resynchronized and out-of-sync messages are reported too. Observability Kit uses these events.service.getEventBus().addListener(RequestEndedEvent.class, e -> { if (e.getDuration().toMillis() > 1000) { log.warn("Slow request: {} ms", e.getDuration().toMillis()); } });
-
Client-side request events (#26064, #26305) —
client.eventsfiresvaadin-requestandvaadin-server-message, so page scripts can time each round trip. -
An event when the browser-too-old page is shown (#26227).
Spring and security
-
Choose where users go after login and handle failed logins (#25965)
VaadinSecurityConfigurer.successUrlResolver(...)picks the URL after login, for example by role, andfailureHandler(...)replaces the default redirect back to the login view. -
Expired sessions the client understands (#25625) — with Spring Security concurrency control, an expired session now shows Vaadin's session expired dialog instead of a plain text page.
-
Opt-in Keycloak role mapping (#25627) and merged packages from several
@EnableVaadinannotations (#26482).
Styling and frontend
-
Load a style sheet into a CSS cascade layer (#26133)
Styles in a layer lose to unlayered styles, so your own CSS overrides a theme without fighting selector specificity.
@StyleSheet(value = Aura.STYLESHEET, layer = "aura") @StyleSheet("styles/app.css") public class Application implements AppShellConfigurator { }
-
Runtime ES modules with
@JavaScript(type = MODULE)(#24239, #24653) — loaded as a<script type="module">at runtime, without bundling.
Components, data binding and API
-
Null-safe converters in
Binder(#23946)Converters built from mapper functions such as
LocalDate::parseno longer need hand-written null handling.binder.forField(birthDateField) .withNullSafeConverter(LocalDate::parse, LocalDate::toString, Exception::getMessage, "") .bind(Person::getBirthDate, Person::setBirthDate);
-
"Or throw" accessors (#26163) —
component.getUIOrThrow(),ui.getSessionOrThrow()andVaadinService.getCurrentOrThrow()fail with a clear message instead of a bareNullPointerException. -
Component.findAncestor(predicate)(#26035) andExtendedClientDetails.getZoneId()for the browser time zone (#26036). -
DefaultInstantiatorcan use non-public no-argument constructors (#27047). -
Element.setAttribute(name, null)removes the attribute (#26263). -
A
VaadinServicemethod to apply the session lock check strategy (#27071).
Build, development loop and tooling
- The Vaadin CDI add-on and Quarkus extension are built and released with Flow (#25525, #25736) — they follow the Flow version from now on; group and artifact IDs are unchanged.
- The dev loop runs on more application servers (#25851) — WildFly, TomEE, Payara Server, Payara Micro, Open Liberty and Apache Tomcat — and can compile with the project's own Maven compiler with
-Dvaadin.dev.compiler=maven(#26203), and pass custom JVM flags with--jvm-args(#26299). - Downloaded Node.js is checked against shipped checksums (#26416), and concurrent builds no longer install Node.js at the same time (#27005).
Automatic-Module-Namein Flow jars (#26731).- Better GraalVM native image support (#26030, #26031, #26039, #26040, #26054, #26164, #26234) —
vaadin.*properties,@EventDatatypes, error views, service providers and i18n locales work in native images. - TypeScript 6 is provided alongside the native compiler (#25911), and
@vaadinpackages are excluded from the minimum npm package age (#25620).
Major Refactorings
-
Flow's server-initiated JavaScript moved from strings to declared JavaScript (#25749, #25853, #25858, #26858, #26845, #26953)
The framework's own JavaScript is collected into the frontend bundle, and the server sends a reference to it instead of script text; each script is sent once per session. This is what makes the strict CSP mode possible. No application code changes required, but an existing frontend bundle is rebuilt once, and tools that read the raw UIDL see a different
executeformat. -
gentyref replaced with plain JDK reflection (#26721).
-
Sessionless request handlers (#26535) — web component scripts, translation files and favicon requests are answered without creating a session (#26304, #26532).
Dependency Updates
Compared with 25.3.0:
- Node.js updated to 26.13.1 (from 24.21.0), now the minimum version
- npm updated to 11.20.0 (from 11.19.0), pnpm to 11.28.9 (from 11.26.0)
- Vite updated to 8.3.8 (from 8.3.0),
@vitejs/plugin-reactto 6.3.0 (from 6.1.1) - React updated to 19.3.1 (from 19.3.0), React Router to 8.5.1 (from 8.4.0)
- Tailwind CSS updated to 4.3.5 (from 4.3.3)
- Spring Boot updated to 4.2.0-RC2 (from 4.1.1)
- Jackson BOM updated to 3.1.8 (from 3.1.5)
- Jetty updated to 12.1.15 (from 12.1.13)
- Hibernate Validator updated to 9.1.6.Final (from 9.1.3.Final)
- Guava updated to 33.8.0-jre (from 33.7.1-jre)
- jsoup updated to 1.24.1 (from 1.23.2)
- SLF4J updated to 2.0.20 (from 2.0.19)
- Atmosphere client updated to 4.0.3 (from 4.0.1)
- TestBench updated to 25.4 (from 25.3)
- Quarkus 3.33.0 (Quarkus extension, now built with Flow)
Changes since 25.4.0-alpha7
New features
- Merge OpenInNewTab into Download with a DownloadTarget (#27074)
- Add Automatic-Module-Name to Flow jars (#26731)
- Let DefaultInstantiator use non-public no-arg constructors (#27047, #27029)
- Add VaadinService method to apply session lock check strategy (#27071, #27056)