Spring boot Can';使用contextPath/foo(Vue.js.&x2B;Spring Boot)渲染视图

Spring boot Can';使用contextPath/foo(Vue.js.&x2B;Spring Boot)渲染视图,spring-boot,vue.js,webpack,Spring Boot,Vue.js,Webpack,我有一个前端基于Vue.js的应用程序,后端基于Spring Boot 我的生产应用程序不在服务器的根目录下,它是localhost:8090/ui中的一个子路径。这是我的应用程序。yml: server: port: 8090 servlet: contextPath: /ui 我在config/index.js中设置了AssetPublicPath:'/ui',因此index.html中的所有引用都类似于/ui/static/… 根据Google Chrome,我的生产服务

我有一个前端基于Vue.js的应用程序,后端基于Spring Boot

我的生产应用程序不在服务器的根目录下,它是
localhost:8090/ui
中的一个子路径。这是我的应用程序。yml

server:
  port: 8090
  servlet:
    contextPath: /ui
我在
config/index.js
中设置了
AssetPublicPath:'/ui'
,因此
index.html
中的所有引用都类似于
/ui/static/…

根据Google Chrome,我的生产服务器成功地返回了我的所有静态资产,如
localhost:8080/ui/static/images/example.png
,但由于某种原因,我看不到我的ui

由于我将前端实现为一个单页应用程序,因此我配置了服务器,使用WebAutoConfig将所有内容重定向到
index.html
,如下所示:

@Configuration
public class WebAutoConfig implements WebMvcConfigurer {
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/")
                .setViewName("forward:/index.html");
    }
}
我还在
router\index.js
中使用
模式:“历史记录”
属性。没有它,一切都可以正常工作,但我不希望URL中出现难看的哈希,比如
localhost:8090/ui/#/
。此外,即使启用了历史模式,但没有子路径,即
contextPath://


谢谢你

你解决了这个问题吗?我也面临同样的问题