【问题标题】:Vaadin 10+ Upload component with Spring-Boot 2+Vaadin 10+ 使用 Spring-Boot 2+ 上传组件
【发布时间】:2019-07-30 15:26:46
【问题描述】:

有没有人能够让 Vaadin 的 Upload 组件与 Spring Boot 一起使用?

诸如禁用 spring 的分段上传之类的解决方法对我不起作用。 (通过我需要多部分)

这是我的项目 pom.xml 配置:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

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

    <pluginRepositories>
        <!-- Repository needed for prerelease versions of Vaadin -->
        <pluginRepository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </pluginRepository>
    </pluginRepositories>

    <repositories>
        <!-- Repository needed for prerelease versions of Vaadin -->
        <repository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </repository>
        <!-- Repository used by many Vaadin add-ons -->
        <repository>
            <id>Vaadin Directory</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-upload-flow</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-tabs-flow</artifactId>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-text-field-flow</artifactId>
            <!--<version>LATEST</version>-->
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-grid-flow</artifactId>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.5</version>
        </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>

application.propertis:

spring.servlet.multipart.enabled=false
spring.mvc.hiddenmethod.filter.enabled=false

我试过 Vaadin 12、13 和你看到的 10.0.7

Upload 的所有侦听器都没有被调用。

也许您可以推荐任何其他方式/组件来替代 Vaadin 的 UI 上传?

编辑:这里是测试仓库:https://github.com/zapphyre/vaadin-upload-test.git

谢谢

【问题讨论】:

  • 是的,我在 Spring Boot 应用程序中使用 Upload 组件。到底什么不适合你?能出示一下相关代码吗?
  • 你不是第一个遇到这个的-here是关于它的github问题,但是看到你的application.properties我猜你已经读过了。
  • 对,我需要转转

标签: java spring-boot vaadin vaadin-flow


【解决方案1】:

实际上它(在 .properties 文件中设置的这个解决方法)有效,我刚刚发现,我在项目根目录上有另一组 .properties 文件,它们可能覆盖了资源中的文件..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-01-30
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 2021-03-04
    • 2015-06-14
    • 2015-05-23
    • 1970-01-01
    相关资源
    最近更新 更多