Skip to main content

So close to a tweetable Springboot Vaadin application

Springboot allows you to run a Groovy script with nearly no ceremonial boilerplate code around it from command line (e.g. just annotate a Groovy class with @RestController). For quick GUI tests this would be great. Right now, sadly it needs alot boilerplate...

@Grapes([
@Grab('org.vaadin.spring:spring-boot-vaadin:0.0.5.RELEASE'),
@Grab('com.vaadin:vaadin-server:7.4.1'),
@Grab('com.vaadin:vaadin-client-compiled:7.4.1'),
@Grab('com.vaadin:vaadin-themes:7.4.1'),
])
import org.vaadin.spring.annotation.VaadinUI
import com.vaadin.server.VaadinRequest
import com.vaadin.ui.*

@VaadinUI
class MyUI extends UI {
        protected void init(VaadinRequest request) {
                setContent(new Label("Hello World"))
        }
}

Store as vaadin.groovy and run with spring run vaadin.groovy (or even with spring run vaadin.groovy --watch to make it reload automatically). Then navigate your browser to http://localhost:8080.

spring-boot-vaadin pulls in the autoconfiguration for Springboot. And the themes and client-compiled are needed for the theme and the widgetset. server is for having the proper versions (or else we get the transitive ones from the plugin)