Blog

Meet Vaadin 21!

By  
Mikael Sukoinen
Mikael Sukoinen
·
On Sep 8, 2021 12:43:16 PM
·
In Product

Vaadin 21 logo card

We’re happy to announce our latest feature release: Vaadin 21. The new release brings Spring Security helpers to Flow, new features and updates to components, a nullable type definition for Fusion, and more!

Vaadin 21 introduces improvements to the frameworks, tools and components. You can see the full list of included products in the “Included Projects and Change Log” section of the release notes.

Not sure about the difference between the two frameworks? Read the introduction to Vaadin Flow and Fusion for details.

The previous feature release, V20, will continue to receive support for a month.

Want to get started already? Go to start.vaadin.com!

Spring Security helpers

Impacts: Flow and Fusion

Enjoy a reduced amount of boilerplate code to configure Spring Security, and spend the freed-up time on developing your business logic. The Vaadin Spring Security helpers take care of Vaadin’s authentication for you, so you only need to worry about application-specific Spring Security configuration.

@EnableWebSecurity 
@Configuration
public class SecurityConfiguration
                extends VaadinWebSecurityConfigurerAdapter { 

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        // Delegating the responsibility of general configurations
        // of http security to the super class. It is configuring
        // the followings: Vaadin's CSRF protection by ignoring
        // framework's internal requests, default request cache,
        // ignoring public views annotated with @AnonymousAllowed,
        // restricting access to other views/endpoints, and enabling
        // ViewAccessChecker authorization.
        // You can add any possible extra configurations of your own
        // here (the following is just an example):

        // http.rememberMe().alwaysRemember(false);

        super.configure(http); 

        // This is important to register your login view to the
        // view access checker mechanism:
        setLoginView(http, LoginView.class); 
    }

    /**
     * Allows access to static resources, bypassing Spring security.
     */
    @Override
    public void configure(WebSecurity web) throws Exception {
        // Configure your static resources with public access here:
        web.ignoring().antMatchers(
                "/images/**"
        );

        // Delegating the ignoring configuration for Vaadin's
        // related static resources to the super class:
        super.configure(web); 
    }

    /**
     * Demo UserDetailService which only provide two hardcoded
     * in memory users and their roles.
     * NOTE: This should not be used in real world applications.
     */

    @Bean
    @Override
    public UserDetailsService userDetailsService() {
        UserDetails user =
                User.withUsername("user")
                        .password("{noop}user")
                        .roles("USER")
                        .build();
        UserDetails admin =
                User.withUsername("admin")
                        .password("{noop}admin")
                        .roles("ADMIN")
                        .build();
        return new InMemoryUserDetailsManager(user, admin);
    }
}

The Spring Security helpers became available for Fusion in V20 and are now also available for Flow in V21.

Read documentation for Flow

Read documentation for Fusion (available since V20)

RouteScope for Flow Spring integration

Impacts: Flow

RouteScope enables you to share beans/component state inside a route between different UI subparts/fragments. Use DI to inject the beans to the route classes and control when state is shared and when it is cleaned up. It is also possible to specify that your RouteScoped beans remain the same after a refresh by using PreserveOnRefresh.

This change also makes it easier to upgrade to the latest version by providing an easier way to migrate ViewScoped Vaadin 8 views.

Read documentation

Nullability change for Fusion TypeScript code generation

Impacts: Fusion

Previously, all the Java types were generated as required in TypeScript. The new nullability change for Fusion makes it optional for TypeScript to enable undefined values for any nullable type in Java.

Relying on @Nullable caused confusing code, including unnecessary annotations, such as @Nullable, @NotNull, MyEntity, nullableNotNullEntity, etc. to create a form with a combo box that's initially empty, but requires a value.

Dropping @Nullable and making all properties nullable by default resolves that issue, among others.

PresenceManager API

Impacts: Flow

Use the PresenceManager to show users who is working on what, in real time.

The new Collaboration Engine API sets user presence in a topic, keeps track of the users who are currently present and reacts to changes in presence. It provides a simple and flexible way to manage topic data related to user presence and makes it easy to create custom components with collaborative features.

Read documentation

Component updates

Exporting chart as SVG image data

Impacts: Vaadin Charts component

A server-side feature in Vaadin Charts for exporting a chart as SVG image data. This feature enables you to download the chart as an SVG that is easy to convert later and embed into reports.

New Grid event type

Impacts: Vaadin Grid component

A Grid event that is thrown when a cell is focused. 

Generic support types

Impacts: Vaadin Grid, Combo Box and CRUD components

Write code faster with a custom type parameter that enables getting items property, and other public properties, methods and events typed automatically. 

Lumo utility classes

Impacts: Lumo theme

A set of utility CSS classes for common styling needs. Apply them directly to your custom HTML structures.

Read documentation

FAQ

When should I upgrade to V21?

We recommend V21 if you are building with Vaadin Fusion and/or want to try the latest features immediately and provide us with feedback, or if you are already on V20. The feature releases, such as V21, receive 4 months of support. 

Are there any breaking changes between V20 and V21?

No. However, there are some known issues and limitations detailed in the release notes. We kindly ask you to report any issues you may encounter.

How can I get started with V21?

You can configure a V21 project for both Vaadin Flow and Fusion at start.vaadin.com. Don’t worry about making the wrong choice; the frameworks are interoperable.

What’s next?

We create a feature release roughly every quarter. Find details on the Vaadin roadmap.

Mikael Sukoinen
Mikael Sukoinen
Mikael has a passion for writing text, code and music. He’s currently utilising his skills to explain difficult concepts in plain language at Vaadin Ltd.
Other posts by Mikael Sukoinen