Multi UI application with Spring

Greetings to all.

I am new to Vaadin and started recently with Vaadin+Spring.
I need several UIs to build a portal. So I have encounter the problem switching between them:


Given

Two UIs that implement ViewDisplay.
Views created and marked with @SpringView(name=“”, ui = FirstUI.class) annotation. Similarely for SecondUI.
FirstUI has @SpringUI(path=“/”) and SecondUI has @SpringUI(path=“/second”) paths.
FirstUI has a button and by clicking on it I want to redirect to SecondUI.

button.addClickListener(clickEvent -> Page.getCurrent().setLocation(SecondUI.PATH));


Problem

Browser redirects me to new path but the view on SecondUI is blank.

Would be nice if someone could help me to solve this problem
Thanks!

I was debugging since wrote the previous post and seems to me that here is is the problem:

#com/vaadin/spring/internal/SpringViewDisplayPostProcessor.java:106

BeanDefinitionBuilder builder = BeanDefinitionBuilder .genericBeanDefinition(SpringViewDisplayRegistrationBean.class);

During dynamic registration of SpringViewDisplay beans they are added there as

SpringViewDisplayRegistrationBean.class
. This means that first UI that you request will be registered as SpringViewDisplay bean and when if you request second UI it will be used as “display” for navigator.

#com.vaadin.spring.server.SpringUIProvider#configureNavigatorL272 Object springViewDisplay = findSpringViewDisplay(ui); <-- HERE firstly created UI will be returned Do not know if it was done intentionally. Will post an issue to github.

Hi,

I haven’t tried it myself and it might be that there is issues with the new SpringViewDisplay annotation in such a multi UI setup. Could you prepare a small example project what you are trying to approach and attach that to the
related github issue
? That would help to get the issue resolved sooner.

BTW. How are you composing your “portal”, are you sure you need multiple UIs? It might be that you’d be better of by having just one UI and multiple view/subviews. Most often you are better of with just one UI entry point.

chers,
matti

Hi Matti,
I have added the code to reproduce the issue (https://github.com/vaadin/spring/issues/163).

Regarding my architecture, parts of my portal are like separate applications with different servlet paths. I think it would be easier to have UIs for them separately with their own navigators. Of course I can create totaly standalone applications for them to solve the issue with SpringViewDisplay but not sure that I need this right now. I am far away from production and this will be decided later. So far for me it’s easier to have everything in one place, of course, with future possibility to extract them to separate apps.

Hope you’ll solve it. Thanks.

Best,
Kirill

Thanks Kiril, a clean reduced test case! I’ll ping the developer who has recently worked on Spring integration and the navigator autoconfiguration…

Thanks, Matti.

I’ve used vaading-spring 2.1-SNAPSHOT, this issue still exists.