SpringBoot整合Vue部署

SpringBoot整合Vue部署

说明

由于开发采用的前后端分离开发,所以前端用了Vue。后端用了Springboot,然而在开发完成以后。需要将前后端放入到一起去部署,所以想到了将Vue打包后的项目部署到springboot项目中

Vue项目打包

npm run build
#由于我用的是Vue-element-Admin模板,打包命令是
npm run build:prod

SpringBoot项目

在.yml配置文件中设置静态资源路径

 spring.resources.static-locations=classpath:/META-INF/resources/, classpath:/META-INF/resources/webjars/, classpath:/static/

然后目录结构如下
在这里插入图片描述
将项目重启就可以正常访问了:
localhost:8080/index.html

猜你喜欢

转载自blog.csdn.net/weixin_43691942/article/details/106187236