On This Page
Step 1: Have an Spring Boot web project
Obviously you need a valid spring boot project, with Web (MVC) enabled. If you do not have it already, you should create it from IntelliJ or go to Spring Boot Initializr and create a new project with the Web dependency.
Step 2: Add Mateu dependencies
In case you are using maven:
<dependency>
<groupId>io.mateu</groupId>
<artifactId>annotation-processor-mvc</artifactId>
<version>3.0-alpha.101</version>
</dependency>
<dependency>
<groupId>io.mateu</groupId>
<artifactId>mvc-core</artifactId>
<version>3.0-alpha.101</version>
</dependency>
<!-- you need the one below if you want to also serve the static content -->
<dependency>
<groupId>io.mateu</groupId>
<artifactId>vaadin-lit</artifactId>
<version>3.0-alpha.101</version>
</dependency>
copy
Or, in case you are using Gradle:
annotationProcessor("io.mateu:annotation-processor-mvc:3.0-alpha.101")
implementation("io.mateu:mvc-core:3.0-alpha.101")
implementation("io.mateu:vaadin-lit:3.0-alpha.101")
copy
Step 3: 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 mvc application, you will find your ui at http:localhost:8080 (for the code above) as expected:
Troubleshooting
In case you are using a maven project and you are setting custom annotation processor paths (e.g. because you are using mapstruct) you must add the annotation processor from Mateu, in your pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source> <!-- depending on your project -->
<target>1.8</target> <!-- depending on your project -->
<annotationProcessorPaths>
<path> <!-- when using mapstruct -->
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>io.mateu</groupId>
<artifactId>annotation-processor-mvc</artifactId>
<version>3.0-alpha.101</version>
</path>
<!-- other annotation processors -->
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
copy