Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Spring Initializr Vaadin demo app, https://start.spring.io/
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;
@SpringBootApplication
public class DemoApplication {
// This is a runnable Spring Boot application
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
/* Business Service Facade.
* Annotate your business services with @Service and they
* will be autodetected by the framework.
*/
@Service
public static class MyService {
public String sayHi() {
return "Hello Spring Initializr!";
}
}
/* Vaadin UI class.
* Specify the theme and URI path for the
* web application.
*/
@Theme("valo")
@SpringUI(path = "")
public static class VaadinUI extends UI {
// You can easily autowire the services to you
// Vaadin applications
@Autowired
MyService myService;
@Override
protected void init(VaadinRequest request) {
setContent(new Label(myService.sayHi()));
}
}
}
@samie
Copy link
Author

samie commented Apr 20, 2015

Yes, this just a helloworld. For full-featured Spring-Vaadin sample you should check out this one: https://github.com/mstahv/spring-data-vaadin-crud

@samie
Copy link
Author

samie commented Sep 17, 2015

There is also an another example with Spring Data, REST and server push: https://github.com/samie/spring-vaadin-demo

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