spring boot 實現跨域訪問

今天項目中使用的前後端分離,前端使用Vue ,後端使用使用springbioot; 在同一臺機器上調試,因爲端口不一致出現錯誤axios Origin 'http://localhost:8080' is therefore not allowed access. 解決方案:服務器端配置跨域: 如圖再springboot 的入口類 Application中做如下修改,即可:
相關文章
相關標籤/搜索