Vaadin, the polyglot framework for building web apps with UI components, released version 1.1 of their Vaadin Spring project.

There are two new features related to Vaadin’s Navigator class and View interface:

A new SpringNavigator class

class A new @SpringViewDisplay annotation

The SpringNavigator class “greatly simplifies the configuration of views” and the @SpringViewDisplay annotation “can be used to mark the target Vaadin component, where your views should actually be displayed.”

There were also a number of bug fixes including serialization of HTTP sessions using Vaadin Spring.

Use of the SpringNavigator class and @SpringViewDisplay annotation are demonstrated in the following code snippets:

// MainUI.java @SpringUI @Theme("valo") public class MainUI extends UI { MainViewDisplay mainContent; public MainUI(MainViewDisplay mainContent,SpringNavigator navigator) { this.mainContent = mainContent; navigator.setErrorView(ErrorView.class); } /// additonal supporting code... }

// MainViewDisplay.java @SpringViewDisplay public class MainViewDisplay extends Panel implements ViewDisplay { public MainViewDisplay() { setStyleName(ValoTheme.PANEL_BORDERLESS); } @Override public void showView(View view) { // Assuming Views are components, which is often the case setContent((Component)view); } }

The entire project on GitHub includes a source code change set for the above Java files that demonstrates simpler code for navigating and managing views.

InfoQ spoke to Matti Tahvonen, product marketing manager at Vaadin, about this release.

InfoQ: What are your current responsibilities at Vaadin?

Tahvonen: My official title is product marketing manager for Vaadin Framework and related OS libraries (like Vaadin Spring), but my work is more like developer advocacy. I write release blog posts, example integration projects with Vaadin and other interesting Java technologies, technical articles, host webinars, visit conferences (speaking and booths staff), help new users and customers with Vaadin development, help our engineering and others working in technical marketing. I’m a huge OSS enthusiast and I am privileged to work mostly on our OS offerings while my colleagues will take care of the commercial extensions we have for Vaadin.

InfoQ: What makes Vaadin unique over other Java web frameworks?

Tahvonen: Vaadin has the strongest abstraction of web technologies. Writing an application with Vaadin Framework doesn’t require you to touch a single line of JS, HTML or CSS (although you can use those if you like) and you don’t need to understand browser quirks or HTTP communication in its many forms (basic HTTP, form posts, AJAX, server push, WebSockets). You’ll go to low level web programming only if you wish to write custom extensions, which are rarely required, thanks to our active community and hundreds of add-ons. Most often you’ll just work with plain Java and a component based programming model, which makes development easy and efficient. Typically developers with experience on desktop UIs (Swing, SWT, JavaFX) or “backend developers” are super excited about Vaadin, but there are Vaadin enthusiasts with PHP background as well :-)

InfoQ: What are your thoughts on how Vaadin and UIs, in general, will fit in the microservices model?

Tahvonen: A super common question these days. Vaadin suits very well for microservices and in general there is always a UI, at some level at least. There are multiple strategies for UIs, best solution depends on your requirements. Vaadin suits really well for cases where you have a UI in your service or an admin UI built with Vaadin + a (REST) service for other applications to consume. But Java is also a perfect tool to consume REST services (without same origin restrictions), so Vaadin works well also when creating mash-ups which consume data from multiple micro services. This question has been posed by so many of our customers lately that we actually decided to write some content and examples for the topic. Here is a first article we built with my colleague Alejandro. There are still lot of content and examples to be published.

InfoQ: What’s on the horizon for Vaadin and/or Vaadin Spring?

Tahvonen: Vaadin 8 is definitely the largest thing coming up soon. Some of the current APIs in Vaadin originate from an era before lambdas and even before generics or a proper collections framework in the JDK. Vaadin 8 will be a major step forward and make code more type safe, easier to write and also more efficient in terms of CPU and memory usage. From Vaadin Spring there will naturally be an updated version as well. Because we take backwards compatibility very seriously (most Vaadin apps are maintained for a long time), we have prepared a compatibility package that makes upgrading really easy, and you can gradually start to use the new APIs. Also version 7 will still be supported, as some of our customers still cannot move to Java 8, and some even need to support IE 8. We are currently in beta phase; the first beta version was published just before the Christmas holiday: https://vaadin.com/blog/-/blogs/vaadin-8-beta-is-out-we-need-your-help- Related to Vaadin Spring, we plan to add some helpers for Spring Security. Most Vaadin Spring users also use Spring Security and with bit deeper integration we believe we could make things simpler to get started.

InfoQ: How is the performance/responsiveness compared to native JavaScript frameworks, such as AngularJS or ReactJS?

Tahvonen: This is something that many developers are afraid of when starting to evaluate Vaadin. I’d suggest to them to try it out themselves. If (and as it usually is) the session is in the memory of the server, server basic visits are very fast, unless your server is in the opposite side of the world. Look at what Google’s search does these days, it hits the server after each keypress and it still feels responsive. In one example we did with Amazon’s experts with their geographical load balancing, I successfully played a Vaadin based Tetris on an EC2 micro instance running in Sydney (I’m located in Finland). It wasn’t perfectly smooth anymore (if you compare to a server on the same continent), but for normal business apps that would have worked just fine. Server latency can be further cut down by enabling WebSocket based constantly open communication channel (one dependency and @Push annotation to the UI class in Vaadin). More than the latency coming from a server roundtrip, one should be afraid of latency coming from browser rendering, and the execution of actual business logic or DB queries, just like with Angular and React. With both Vaadin and client side UI frameworks, I suggest to show some progress indicator or dialog for long running queries, not to make the UI appear to be stalled.

Tahvonen and Stéphane Nicoll recently recorded a webinar on building Java web apps with Vaadin and Spring.