1.在controller 上加上

@CrossOrigin(origins = {"http://localhost:7777", "http://someserver:8080"})

 

  eg:localhost  意思是允许本地跨域访问

        7777:允许访问的端口号

 

@RestController
@RequestMapping("/order")
//@CrossOrigin(origins = {"http://localhost:7777", "http://someserver:8080"})
@CrossOrigin(origins = {"http://192.168.18.156:4200"})
public class OrderController {
    
    @Autowired
    private OrderService orderService;

 

posted on 2018-08-28 20:22  lshan  阅读(3014)  评论(0编辑  收藏  举报