spring icon indicating copy to clipboard operation
spring copied to clipboard

@UIScoped view gets reinstantiated upon navigation

Open peterl1084 opened this issue 8 years ago • 3 comments

If a view is defined with @SpringView(name="view") and @UIScope, it still gets its constructor invoked every time the view is navigated into with navigator.navigateTo("view").

As this is @UIScoped it should use the same instance and provide same behaviour as what standard Navigator does when view is registered with instance, instead of type.

peterl1084 avatar Dec 07 '16 10:12 peterl1084

Hi, I had the same trouble... I thought, annotations don't have an order, but we fixed the problem by re-order the annotations.

Try to define first the scope and than the SpringView, that works fine to me.

@UIScope
@SpringView(name = "SampleView")

flo-ferox avatar Dec 15 '16 06:12 flo-ferox

The reason for this issue is that @SpringView already includes @ViewScope (which overrides your @UIScope)

BTW @flo-ferox the order should be irrelevant and I would prefer an error or exception when multiple scopes are used (and in conflict) on the same component/bean

ak99372 avatar Jan 16 '17 04:01 ak99372

@ak99372 I agree, order should be irrelevant, but it wasn't for me. I could solve the problem by re-order the annotations. I also don't got an exception/conflict message.

flo-ferox avatar Jan 16 '17 10:01 flo-ferox