Last active
November 8, 2016 06:17
-
-
Save samie/56a09e7301084514bcef to your computer and use it in GitHub Desktop.
Spring Initializr Vaadin demo app, https://start.spring.io/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | |
} | |
} | |
} |
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
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