Serializable Service References for Vaadin Flow

This mini add-on provides serializable service references. Currently Spring Boot is supported, but there's also an untested implementation for CDI included as well; contact me if you're interested.

What does this do and how does it work?

Vaadin stores all UIs in their respective HTTP session. If you want to be able to persist your sessions (so they survive a server restart or can be migrated to a different server), everything in these UIs needs to be serializable. While dependency injection provides easy and convenient access to your services, these services aren't and shouldn't be serializable. You could always use static methods to access your services, but you would lose the convenience of DI. This add-on solves this by injecting serializable service references instead of services directly.

Example

Inject your service like this:

// Spring
@Autowired
private ServiceRef<MyService> myService;

// CDI
@Inject
private ServiceRef<MyService> myService;

And then use it like this:

myService.get().doStuff();

Install

Link to this version
ExperimentalReleased 02 November 2020Apache License 2.0
Framework Support
Vaadin platform 14+
Browser Independent
Install with
Release notes - Version 0.5.0