脚本宝典收集整理的这篇文章主要介绍了springboot整合vue小试牛刀,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- mvn process-resources -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy Vue.js frontend content</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources/static</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/vue-demo/dist</directory>
<includes>
<include>static/</include>
<include>index.html</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
在springboot工程整合vue的话,将静态文件拷贝到src/main/resources/static目录下即可,这样就可以在springboot工程打开静态文件了,对api的请求也无需再转发,也没有跨域问题,比较适合管理后台前端资源的整合。
以上是脚本宝典为你收集整理的springboot整合vue小试牛刀全部内容,希望文章能够帮你解决springboot整合vue小试牛刀所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。