In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2026-02-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail the "SpringCloud Feign multi-parameter transmission methods and need to pay attention to what problems", detailed content, clear steps, details handled properly, I hope that this "SpringCloud Feign multi-parameter transmission methods and need to pay attention to what problems" article can help you solve doubts, the following with the editor's ideas slowly in-depth, together to learn new knowledge.
Multi-parameter transfer of Feign and problems needing attention
The previous Eureka,Feign,Service is used here.
Add several methods in the service provider cloud-shop-userservice / * Save users * 18 / PostMapping ("/ user") public String aveUser (@ RequestBody User user) {logger.info ("Save users:" + user.toString ()); return "Success" } / * query users based on username and password * 18 / GetMapping ("/ findUser") public User findUserByNameAndPassword (String name, String password) {logger.info ("name:" + name + "--password:" + password); User user= new User () User.setName (name); user.setPassword (password); return user;} modify the UserService of feign and add the corresponding method package cn.sh.daniel.service; import org.springframework.cloud.netflix.feign.FeignClient;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.PathVariable;import org.springframework.web.bind.annotation.PostMapping Import org.springframework.web.bind.annotation.RequestBody;import cn.sh.daniel.entity.User; @ FeignClient (value = "cloud-shop-userservice") public interface UserService {@ GetMapping ("/ user/ {id}") public User findUserById (@ PathVariable ("id") Long id); @ PostMapping ("/ user/user") public String aveUser (@ RequestBody User user) @ GetMapping ("/ user/findUser") public User findUserByNameAndPassword (String name, String password);} call the method in the controller of feign / * Save user * January 18, 2018 * / @ PostMapping ("/ user") public String aveUser (@ RequestBody User user) {return userService.aveUser (user) } / * query the user based on user name and password * January 18, 2018 * / @ GetMapping ("/ findUser") public User findUserByNameAndPassword (String name, String password) {return userService.findUserByNameAndPassword (name, password);} restart the modified service to check whether the service registration is normal
During the startup process, you can find the Feign service startup error:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.