原 學習spring cloud系列(二)使用RestTemplate進行跨模塊調用方法

在上一篇的基礎上進行增加,有興趣可以看一下,https://blog.csdn.net/baidu_37302589/article/details/100881769

1.首先在eureka-client-01新建controller方法

2.再在eureka-client-02中注入RestTemplate實例,並開啓負載均衡

3.創建TestController使用RestTemplate調用eureka-client-01中的hello方法並返回結果

4.訪問http://localhost:8763/test/sendMsg?name=admin就能看到hello打印傳遞的值

想了解更多的RestTemplate相關知識可以參考大佬的博客

https://blog.csdn.net/u012702547/article/details/77917939

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章