【问题标题】:Spring boot does not serve assets in resources folder when started with IntelliJ使用 IntelliJ 启动时,Spring Boot 不提供资源文件夹中的资产
【发布时间】:2018-12-30 13:16:29
【问题描述】:

我正在做很多this 教程。基本上你有一个控制两个模块的 pom,frontend modulebackend module

环境:IDE: Intellijspring-bootVue.js

我使用vue init webpack frontend 初始化了frontent module。我将 pom 添加到 backend module,它将 assets 复制到 backend module asset/public 文件夹中。在mvn clean install 之后,所有内容都在ressources/public 文件夹中,但是当我查看浏览器源时,它没有显示任何内容。

资源文件夹如下所示:

└── resources
    ├── application.properties
    └── public
        ├── index.html
        └── static
            ├── css
            │   ├── app.30790115300ab27614ce176899523b62.css
            │   └── app.30790115300ab27614ce176899523b62.css.map
            └── js
                ├── app.b22ce679862c47a75225.js
                ├── app.b22ce679862c47a75225.js.map
                ├── manifest.2ae2e69a05c33dfc65f8.js
                ├── manifest.2ae2e69a05c33dfc65f8.js.map
                ├── vendor.42fc6c515ccdfe89bd76.js
                └── vendor.42fc6c515ccdfe89bd76.js.map

我刚刚注意到运行java -jar backend/target/backend-0.0.1-SNAPSHOT.jar 可以解决问题。但是当我使用 intellij 启动应用程序时,它并没有成功。

完整树(仅限目录):

├── fileconverter
│   ├── backend
│   │   ├── src
│   │   └── target
│   ├── frontend
│   │   ├── build
│   │   ├── config
│   │   ├── node
│   │   ├── node_modules
│   │   ├── src
│   │   ├── static
│   │   ├── target
│   │   └── test
│   └── target
│       ├── classes
│       └── test-classes

【问题讨论】:

    标签: javascript maven spring-boot intellij-idea vue.js


    【解决方案1】:

    好的,因为我有两个模块 IntelliJ 使用整个项目的类路径而不是 backend 模块。

    将配置中的路径更改为:Use classpath of module: backend 后一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-13
      • 2017-06-01
      • 2016-05-04
      • 2017-02-25
      • 2017-02-05
      • 2020-10-12
      • 2018-05-28
      • 1970-01-01
      相关资源
      最近更新 更多