Skip to content

Instantly share code, notes, and snippets.

Last active November 8, 2016 06:17
Show Gist options
  • Save samie/56a09e7301084514bcef to your computer and use it in GitHub Desktop.
Save samie/56a09e7301084514bcef to your computer and use it in GitHub Desktop.
Spring Initializr Vaadin demo app,
package demo;
import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Service;
public class DemoApplication {
// This is a runnable Spring Boot application
public static void main(String[] args) {, args);
/* Business Service Facade.
* Annotate your business services with @Service and they
* will be autodetected by the framework.
public static class MyService {
public String sayHi() {
return "Hello Spring Initializr!";
/* Vaadin UI class.
* Specify the theme and URI path for the
* web application.
@SpringUI(path = "")
public static class VaadinUI extends UI {
// You can easily autowire the services to you
// Vaadin applications
MyService myService;
protected void init(VaadinRequest request) {
setContent(new Label(myService.sayHi()));
Copy link

samie commented Apr 20, 2015

Yes, this just a helloworld. For full-featured Spring-Vaadin sample you should check out this one:

Copy link

samie commented Sep 17, 2015

There is also an another example with Spring Data, REST and server push:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment