问题描述
是否可以使用 maven-frontend-plugin
在 Spring Boot 应用程序上运行 Vue?
spring.io 上有关于使用 React 执行此操作的官方指南 - 您必须使用插件的 webpack
目标来生成 bundle.js
,然后将其包含在您的页面中(在我的情况下是 Thymeleaf是模板引擎)。
我对 Vue 做了同样的事情,但页面加载时似乎没有任何反应。如果这不可能,那么将 Vue 前端与 Spring Boot 后端结合使用的最简单方法是什么?
解决方法
我找到了这个似乎是唯一可用的解决方案:https://escuela-tech.medium.com/deploy-vuejs-application-in-tomcat-b0010c2f8395
基本上,您只需使用 npm run-script build
构建可部署的 js 和 css,然后将其附加到您的页面。