SpringMvc+Tomcat+Angular4 部署运行
這次的團隊開發是,前端開發人員和后臺開發人員完全分開開發的。
前端開發采用了Angular4,webstorm
后端開發采用了:spring+springmvc+mybatis,eclipse
---------------------------------------
最后要整合了。
1、angular項目編譯
會生成 dist 文件夾。
2、拷貝dist文件夾到eclipse項目文件里
3、修改dist/index.html的<base href="">
改為項目名+文件名
/doapplication/dist/
<base href="/doapplication/dist/">
4、springmvc文件里增加<mvc:resources 節點配置
<mvc:resources location="/dist/" mapping="/dist/**" />
5、運行,訪問
http://localhost:8080/doapplication/dist/index.html
----------2018-01-04---補充
修改dist/index.html的<base href="">
改為項目名+文件名
/doapplication/dist/
<base href="/doapplication/dist/">
放到同一個tomcat的webapp下,后臺代碼不用做任何修改和配置,啟動tomcat直接可以訪問。
訪問路徑:/項目名/dist/index.html
總結
以上是生活随笔為你收集整理的SpringMvc+Tomcat+Angular4 部署运行的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: nginx一个server多个serve
- 下一篇: SpringBoot自定义Starter