Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to transfer entity Bean in Feign

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to transfer entity Bean in Feign". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to transfer entity Bean in Feign"!

How to transfer entity Bean to Feign

Need to add a @ RequestBody serialization object

/ * * add * / @ PostMapping ("saveOrder") @ ResponseBody public void saveOrder (@ RequestBody OrderBean orderBean) {userService.saveOrder (orderBean);}

An @ RequestBody annotation should also be added to the API to receive requests.

/ * add * @ param orderBean * / @ PostMapping ("saveOrder") public void saveOrder (@ RequestBody OrderBean orderBean); Feign injects Bean as null to start error reporting

It is mainly due to the conflict between feign version and swagger version. The spring cloud version of this project is Finchley.M8.

Swagger conflicting version io.springfox springfox-swagger2 2.2.2 io.springfox springfox-swagger-ui 2.2.2 solution io.springfox springfox-swagger2 2.5.0 Io.springfox springfox-swagger-ui 2.5.0 feign Service case @ FeignClient (name = "service-weixin" Fallback = OAuthServiceFallBack.class, configuration = FeignConfig.class) public interface OAuthService {@ RequestMapping (value = "/ oauth/getOauth3AuthorizationUrl", method = RequestMethod.GET) ResultBean getOauth3AuthorizationUrl (@ RequestParam ("url") String url) } controller injection @ RestController@RequestMapping ("/ ticket") public class TicketController {@ Autowired private TicketService ticketService; @ Autowired private OAuthService oAuthService;... At this point, I believe you have a deeper understanding of "how to achieve entity Bean in Feign". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report