Annotation Interface RouteScoped
Every RouteScoped bean belongs to one router component owner. It can be a
@Route component, or a RouterLayout, or a
HasErrorParameter. Beans are qualified by
@RouteScopeOwner to link with their owner.
Until owner remains active, all beans owned by it remain in the scope.
Without the RouteScopeOwner annotation the owner is the current route
target component (dynamically calculated). With nested routing hierarchies,
the target is the "leaf" or "bottom most" routing component. The beans are
preserved as long as the owner component remains in the navigation chain. It
means that the bean may be preserved even if the navigation target is changed
(but the "initial" calculated owner is still in the navigation chain).
Injection with this annotation will create a direct reference to the object rather than a proxy.
There are some limitations when not using proxies. Circular referencing (that is, injecting A to B and B to A) will not work. Injecting into a larger scope will bind the instance from the currently active smaller scope, and will ignore smaller scope change. For example after being injected into session scope it will point to the same RouteScoped bean instance ( even it is destroyed ) regardless of UI, or any navigation change.
The sister annotation to this is the NormalRouteScoped. Both
annotations reference the same underlying scope, so it is possible to get
both a proxy and a direct reference to the same object by using different
annotations.