Blog

Spring Time for Vaadin

By  
Petter Holmström
·
On Feb 13, 2014 6:22:00 AM
·



Originally, the idea of the webinar was to show you how Spring has been used in different Vaadin projects in the past. However, once Josh Long from Pivotal got involved, we ended up creating a first prototype of a completely new integration that will sweep the floor with the conventional ways. This changed the webinar quite a bit.

In the past, there were basically two ways of integrating Vaadin and Spring if you did not want to or could not use any third-party addons. The first approach was to create a custom Vaadin UI provider that fetches the UI-instances from a Spring web application context and plugging it into the Vaadin servlet. This is quite easy to set up, but it limits you to the prototype scope and causes problems if your UI needs to be serializable.

The second approach was to use AspectJ to inject references into your Vaadin UI components. This approach does not require any custom servlets or UI providers, it works with serialization and can be used with existing Vaadin applications that have been created without Spring in mind. However, you need to use the AspectJ compiler and an IDE that supports AspectJ.

The examples from the webinar can be found here: https://github.com/peholmst/vaadin-spring-webinar

In the future, you will be able to seamlessly add a Vaadin UI to your Spring application with the help of Spring Boot. Just make sure you have the right JARs in your classpath and start coding Vaadin user interfaces. No need for any XML files or custom servlets. No scoping problems. Seamless integration with Spring Security.

The new integration add-on that's cooking can be found here: https://github.com/peholmst/vaadin4spring

Officially it is still only an R&D prototype, meaning that although Vaadin is participating in the development, it is not yet an official Vaadin product and thus is not officially supported. The plan is, however, to fork it into an official add-on once the API and features have become stable enough.

Petter Holmström
Petter (with two T:s) works as a software architect at Vaadin, mostly in customer projects. He is constantly on the lookout for new and better ways of writing software and he likes to try out new things. On his spare time, he likes to put out fires.
Other posts by Petter Holmström