preface
A few days ago, I introduced Feign to call the Little Yellow map API, which is obviously not the most elegant way to use it. But for most of the small and medium-sized companies, the service has been removed so much hot, basic can meet the demand can be, what fuse, cluster ah can rely on the first side.
Here’s a simple example to share with you.
component
- Spring – the Boot 2.2.0. RELEASE
- Spring-Cloud Greenwich.SR3
- Spring – the Cloud – Alibaba 2.1.0. RELEASE
- Nacos Registry
- Feign HTTP client
To clarify, Spring Cloud Alibaba has successfully graduated on August 1, 2019, and has been officially listed in Spring. The latest version is 2.1.0 after being successfully listed.
The main project
The service side
Application. The properties configuration:
Simple service provision interface:
The client
Application. The properties configuration:
Configure the client call interface:
Examples of client calls:
Testing services
Start feign-server and Feign-client respectively, and then log in to the Nacos console. If the following two services appear, the configuration is successful.
The client visit http://localhost:8081/getMessage if it returns to Dally with me that the call is successful.
summary
Finally or welfare time, there is a need for source partners can read the original text to pull, in order to facilitate debugging, there is also a built-in free Nacos registry.