我的個人網站:
http://riun.xyz
1、修改vuejs的config/index.js,在裏面找到assetsPublicPath,改爲/dist/,記住,是build:{}這裏的,不是上面dev:{}的。
2、執行npm run build,會出現一個dist文件夾在vuejs項目目錄裏。
3、把這個dist文件夾copy到springboot的resources/static/,是整個dist連文件夾一起copy過來。如下圖
4、SpringBoot項目只需要parent依賴和web依賴即可。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
5、啓動,訪問:http://localhost:8080/dist/index.html