1,spring boot配置项:需要注意的是spring boot中有许多类名相同的,避免引错包。
![](https://upload-images.jianshu.io/upload_images/19077778-3bd733b39bdf5d20.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
包路径
![](https://upload-images.jianshu.io/upload_images/19077778-a8f8c067cacb76d0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
设置过滤配置项,并将过滤器注入spring boot 容器
2,前台配置(当前项目使用vue-cli搭建的项目)
编辑 config/index.js文件,添加proxyTable target指向后台服务ip+port
![](https://upload-images.jianshu.io/upload_images/19077778-cfaeb915bea4380a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
主要配置项
需要提一下的是pathRewrite 即路径重写
配置之后访问后台时:/api/接口名 axios就会自动将当前的ip和端口换成target的内容