maven Vaadin 14“在重新打包后无法导航到“”

rqdpfwrv  于 12个月前  发布在  Maven
关注(0)|答案(2)|浏览(108)

我的项目有问题。也许你可以帮我一点。我目前正在尝试编写一个小webapp。我使用Sping Boot + Vaadin 14。当我在eclipse中测试应用程序时,一切都按设计工作。但是当我用Maven编译我的项目并启动它时,我收到一条错误消息,我的应用程序找不到任何路由。
这是错误消息:

Could not navigate to ''
Reason: Couldn't find route for ''

Available routes:
This detailed message is only shown when running in development mode.

字符串
这是我的pom:

?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.9.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>(REMOVED FOR PRIVACY REASONS)</groupId>
    <artifactId>(REMOVED FOR PRIVACY REASONS)</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>mobileissuecreator</name>
    <packaging>jar</packaging>

    <properties>
        <java.version>1.8</java.version>
        <vaadin.version>14.0.9</vaadin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>


我的应用程序入门类:

package com.cen.spin.mobileissuecreator.springcontroller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.annotation.SessionScope;

import com.vaadin.flow.spring.annotation.EnableVaadin;

@Configuration
@SpringBootApplication
@EnableVaadin("(REMOVED FOR PRIVACY REASONS)")
public class (REMOVED FOR PRIVACY REASONS) extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run((REMOVED FOR PRIVACY REASONS).class, args);
    }

    @Bean
    @SessionScope
    public MICService micService(EnoviaAuthService enoviaAuthService, EnoviaAuthProperties enoviaAuthProperties) {
        return new MICService(enoviaAuthService, enoviaAuthProperties);
    }

    @Bean
    @SessionScope
    public EnoviaAuthService enoviaAuthService(EnoviaAuthProperties enoviaAuthProperties) throws Exception {
        return new EnoviaAuthService(enoviaAuthProperties);
    }

    @Bean
    @SessionScope
    public EnoviaAuthProperties enoviaAuthProperties() {
        return new EnoviaAuthProperties();
    }

    @Bean
    @SessionScope
    public EnoviaRoleSelectorService enoviaRoleSelectorService(EnoviaAuthService enoviaAuthService) {
        return new EnoviaRoleSelectorService(enoviaAuthService);
    }

    @Bean
    @SessionScope
    public EnoviaContextCheckService enoviaContextCheckService(EnoviaAuthService enoviaAuthService) {
        return new EnoviaContextCheckService(enoviaAuthService);
    }

}


如果你能帮我就太好了。
谢谢你,谢谢

toe95027

toe950271#

这个问题是因为你的配置类默认只扫描它所定义的包及其所有的子包。
所以为了解决你的问题,你应该做这些之一:

  • 定义其他要扫描的包,默认情况下尚未扫描。您可以在scanBasePackages annotation中使用scanBasePackages属性进行此操作。
  • 将configuration class在包结构中进一步上移,以便所有必要的spring-components和vaadin views都位于与configuration相同的(或子)包中,因此它们将被默认扫描。

Similar question with multiple answers

pinkon5k

pinkon5k2#

我将@ RouteView(value =“",layout = MainLayout.class)添加到我希望在登录后作为默认页面的视图中

相关问题