On This Page
Step 1: Have a Micronaut project
Obviously you need a valid Micronaut project. If you do not have it already, you should create it from IntelliJ.
Step 2: Add Mateu dependencies
In case you are using maven:
<dependency>
<groupId>io.mateu</groupId>
<artifactId>micronaut-core</artifactId>
<version>3.0-alpha.103</version>
</dependency>
<dependency>
<groupId>io.mateu</groupId>
<artifactId>vaadin-lit</artifactId>
<version>3.0-alpha.103</version>
</dependency>
copy
You also need to add the annotation processor:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths combine.children="append">
<path>
<groupId>io.mateu</groupId>
<artifactId>annotation-processor-micronaut</artifactId>
<version>3.0-alpha.103</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
copy
Or, in case you are using Gradle:
implementation("io.mateu:micronaut-core:3.0-alpha.103")
implementation("io.mateu:vaadin-lit:3.0-alpha.103")
annotationProcessor("io.mateu:annotation-processor-micronaut:3.0-alpha.103")
copy
Step 3: Add some configuration
And add the following annotations to your application:
@Introspected(packages = "io.mateu.dtos")
@SerdeImport(packageName = "io.mateu.dtos")
@Import(packages = {
"io.mateu",
"io.mateu.core.application",
"io.mateu.core.application.getui",
"io.mateu.core.application.createjourney",
"io.mateu.core.application.runaction",
"io.mateu.core.domain",
"io.mateu.core.domain.fragmentmapper",
"io.mateu.core.domain.reflection"
},
annotated = "*")
public class Application {
public static void main(String[] args) {
Micronaut.run(Application.class, args);
}
}
copy
Also, in case you added the frontend dependency, in the application.properties file you need to add the following properties:
micronaut.router.static-resources.assets.mapping=/**
micronaut.router.static-resources.assets.paths=classpath\:static
copy
Step 4: Create your Mateu UI
Nothing special is required. Just annotate your class with @MateuUI
:
package com.example.demo;
import io.mateu.core.domain.uidefinition.shared.annotations.MateuUI;
@MateuUI("")
public class HelloWorld {
}
copy
When you run you spring boot application, you will find your ui at http:localhost:8080 (for the code above) as expected: