Vaadin on Grails

Rapid development of RIA in Vaadin with Grails.

When we were developing Vaadin applications, we were feeling excited about how the development of a user interface was easy. We could play with the UI and still think about it as object structures in Java.
Then we started to think over how beneficial integrating Spring framework into Vaadin could be. We needed dependency injection, AOP, JPA, i18n and environments, which can be provided Grails.
So we have integrated Vaadin in to Grails with this plugin.

The Book

There is Vaadin on Grails Book that is the complete reference manual to work with Vaadin in Grails realm. Thanks for buying the book and supporting the first official and complete documentation for Vaadin integration with Grails.
The book explains basic configuration of project, how to create project, integrate various database frameworks and many other useful tricks to develop Vaadin applications in Grails.



Ready made Vaadin UI components

There is no need to use JavaScript in our apps any longer. Vaadin implements many visual and data binding components. Thanks to Vaadin we are able to implement applications in Java based language like Groovy through Grails as in our case.

No manual mapping between database and domain objects

GORM stands for Grails' object relational mapping. It is ORM implementation using Hibernate 3 or 4. Simply create a domain object and it is automatically mapped to the database table. MongoDB can be used too.

class Author {
    String name

    static hasMany = [books: Book]

    static constraints = {
      name blank: false, size: 6..50


Grails services are the place to put the majority of the application logic. Transaction managements comes for free. Everything in the service is transactional if we do not declare otherwise.

class BookService {

    @Transactional(readOnly = true)
    List<Book> listBooks() {
        return Book.list()

    void updateBook(Book book, OtherInputs inputs) {
        // ...

Dependency injection

Dependency injection is provided by the inbuilt Spring container. We just need to use Grails class from Vaadin plugin to get a bean from Spring application context.

BookService authorService = Grails.get(BookService)


Get localized labels in Vaadin code using standard message bundle files.

String localized = Grails.i18n("key.for.message")


Grails adds per environment configuration for application bootstrap, database or any other configuration.

So we can, for example, run application in production like mode on local.

if (Environment.current == Environment.PRODUCTION) {
    // do stuff that is run-able only in production environment
grails prod run-war

Automatic Spring bean creation

Dependency injection with the inbuilt Spring container. We just need to use Grails class from Vaadin plugin to get a bean from Spring application context.

AuthorService authorService = Grails.get(AuthorService)

Control application with

command line scripting environment built on the Groovy-powered Gant.

grails help
grails create-domain-class com.bookstore.Author
grails clean
grails test-app
grails run-app

See code changes instantly

Embedded Tomcat container which is configured for on the fly reloading, which lowers a need for restarting the application.