Skip to content

Vaadin CDI 3.0.0

Compare
Choose a tag to compare
@tsuoanttila tsuoanttila released this 19 Jan 08:50

Vaadin CDI 3.0.0 is Framework 8.2 compatible version.

A big thank you to @kumm for his work on the major changes included in this release!

This major release contains following changes.

Breaking changes:

NormalUIScoped UIs are not supported

Every @CDIUI has to be @UIScoped. The scope can be omitted for UIs.

ViewScoped context lifecycle has changed

Creation and destruction of view scopes is better aligned with navigation.

@Dependent views are not supported. The behavior of a view scope is the same as you would expect from dependent scope.

Introduced CDINavigator API

To make @ViewScoped work, the CDINavigator should be used instead of standard Navigator.

@CDIUI("")
public class MyUI extends UI {
    @Inject
    CDINavigator navigator;

    @Override
    protected void init(VaadinRequest request) {
        navigator.init(this, myViewContainer);

Navigation can be done by injecting CDINavigator or using ui.getNavigator(), and calling CDINavigator::navigateTo.

New Features:

  • Introduced @VaadinSessionScoped
  • Improved clustering support

ViewContextStrategy

There's a new concept called ViewContextStrategy. It defines when the ViewContext should be released and new one created.

The add-on contains three built-in strategies which are used with an annotation on a view.

  • @ViewContextByNavigation release and creates a new context on every navigation.
  • @ViewContextByName releases and creates a new context when the view name changes.
  • @ViewContextByNameAndParameters releases and creates a new context when the view name or parameters change.

PushStateNavigation

Vaadin Framework 8.2 introduced Navigator feature that uses HTML5 History API for views rather than the old #! URI fragments. This feature is enabled with @PushStateNavigation for the UI class. To use it with CDI, make sure the CDINavigator is being used.

This release contains a number of bugfixes to view scopes and memory leaks.