如何使用Gradle运行vaadin +弹簧靴?

时间:2020-08-01 11:59:48

标签: java spring spring-boot gradle vaadin

我有一个像这样的测试应用程序:

build.gradle

plugins {
    id 'org.springframework.boot' version '2.4.0-M1'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java'
    id 'application'
    id 'com.vaadin' version '0.8.0'
}

wrapper {
    gradleVersion = '6.5.1'
}


group = 'tobi'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '14'
targetCompatibility = '14'
mainClassName = "tobi.test.Main"

repositories {
    mavenCentral()
    maven {
        url 'https://repo.spring.io/milestone'
    }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'com.vaadin:vaadin:14.3.1'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'io.projectreactor:reactor-test'
}

test {
    useJUnitPlatform()
}

MainView.java

package tobi.test.ui;

import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.Paragraph;
import com.vaadin.flow.router.Route;

@Route("/")
public class DashboardView extends Div {{ add(new Paragraph("TEXT")); }}

当我运行gradlew run(或gradlew bootRun)并导航到http://{{app_url}}/时,出现错误消息:

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sat Aug 01 12:49:24 BST 2020
There was an unexpected error (type=Not Found, status=404).

从我阅读的内容来看,这应该可以正常工作。 我还尝试了运行vaadinPrepareFrontend / vaadinBuildFrontend(通过vaadin gradle插件),但这不能解决问题。

有人知道我想念什么吗?

0 个答案:

没有答案