O'Reilly logo

Vaadin 7 Cookbook by Ondrej Kvasnovsky, Jaroslav Holan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Vaadin and Spring injector

We will make a simple application that shows the username on the screen. Our goal in the recipe is to auto inject or maybe (in better terms) autowire Spring beans in the Vaadin application.

Getting ready

Create new Maven project from the Vaadin archetype.

mvn archetype:generate \
 -DarchetypeGroupId=com.vaadin \
 -DarchetypeArtifactId=vaadin-archetype-application \
 -DarchetypeVersion=LATEST \
 -Dpackaging=war \
 -DgroupId=com.packtpub.vaadin \
 -DartifactId=vaadin-spring-injector \
-Dversion=1.0

How to do it...

Carry out the following steps, in order to make a Vaadin application with autowiring via injector:

  1. First, we create a class representing a user.
    public class User { private String name; // generate getters and setters for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required