lifecycle of a view

When I create a view (Put the @Route in my class) it’s correctly every time that I go to that route (

UI.getCurrent().navigate(MyView.class);

) he execute the constructor? this is the correctly behavior of vaadin?

tks

Yes the constructor of your MyView will be called every time that the user navigates there. When the user leaves the MyView, that myView instance is not kept, which means the next time you go there it needs to create a new instance, which is done by calling the constructor.

The only exception to this rule is when you already are in the MyView and refresh the page (not navigate!), the view instance can be reused IF you annotate your MyView class with @PreserveOnRefresh.

Well, creating the view on navigation is the default behavior. You can override this behavior by providing a custom Instantiator or by using the Vaadin Spring add-on and with suitably scoped SpringComponent routes.