https://github.com/vaadin-learning-center/flow-helloworld-maven-meecrowave
Vaadin Flow - HelloWord with maven and Apache Meecrowave
https://github.com/vaadin-learning-center/flow-helloworld-maven-meecrowave
apache java10 jdk maven meecrowave ruppert sven vaadin vaadin-flow
Last synced: about 2 months ago
JSON representation
Vaadin Flow - HelloWord with maven and Apache Meecrowave
- Host: GitHub
- URL: https://github.com/vaadin-learning-center/flow-helloworld-maven-meecrowave
- Owner: vaadin-learning-center
- License: apache-2.0
- Created: 2018-11-27T16:40:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-17T10:42:19.000Z (over 5 years ago)
- Last Synced: 2025-03-25T02:40:15.352Z (2 months ago)
- Topics: apache, java10, jdk, maven, meecrowave, ruppert, sven, vaadin, vaadin-flow
- Language: Java
- Size: 17.6 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HelloWorld - Vaadin - Ramp up in a second.
A nano project to start a Vaadin project. Perfect for Micro-UIs packed as fat jar in a docker image.
This will be used in some of the tutorial implementations.> All tutorials are available under [https://vaadin.com/tutorials](https://vaadin.com/tutorials)
## target of this project
The target of this project is a minimal rampup time for a first hello world.
Why we need one more HelloWorld? Well, the answer is quite easy.
If you have to try something out, or you want to make a small POC to present something,
there is no time and budget to create a demo project.
You don´t want to copy paste all small things together.
Here you will get a HelloWorld-Project that will give you all in a second.Clone the repo and start editing the class ```VaadinApp``` or ```BasicTestUIRunner```.
Nothing more.## How does it work?
This project will not use any additional maven plugin or technology.Here we are using the plain **meecrowave** as Servlet-Container.
[http://openwebbeans.apache.org/meecrowave/index.html](http://openwebbeans.apache.org/meecrowave/index.html)But let´s start from the beginning.
## Start the Servlet-Container (Java)
The class ```BasicTestUIRunner``` will ramp up the Container.Here all the basic stuff is done. The start will init. a ServletContainer at port **8080**.
If you want to use a random port, use ```randomHttpPort()``` instead of ```setHttpPort(8080);```
The WebApp will deployed as **ROOT.war**.```java
public class BasicTestUIRunner {
private BasicTestUIRunner() {
}public static void main(String[] args) {
new Meecrowave(new Meecrowave.Builder() {
{
// randomHttpPort();
setHttpPort(8080);
setTomcatScanning(true);
setTomcatAutoSetup(false);
setHttp2(true);
}
})
.bake()
.await();
}
}
```After this you can start the app invoking the main-method.
## The UI itself
The UI itself is quite easy.
There is only a button you can click.
For every click, the counter will be increased.
For more information about the routing (**@Route(""")**), have a look at the orig documentation
[https://vaadin.com/docs/v10/flow/routing/tutorial-routing-annotation.html](https://vaadin.com/docs/v10/flow/routing/tutorial-routing-annotation.html)```java
@Route("")
public class VaadinApp extends Compositeimplements HasLogger {private final Button btnClickMe = new Button("click me");
private final Span lbClickCount = new Span("0");
private final VerticalLayout layout = new VerticalLayout(btnClickMe, lbClickCount);private int clickcount = 0;
public VaadinApp() {
btnClickMe.addClickListener(event -> lbClickCount.setText(valueOf(++clickcount)));//set the main Component
logger().info("setting now the main ui content..");
getContent().add(layout);}
}
```Happy Coding.
if you have any questions: ping me on Twitter [https://twitter.com/SvenRuppert](https://twitter.com/SvenRuppert)
or via mail.