Whitelist of microservice internal communication
There are many ways to communicate with microservices. Some use sockets, some use HTTP client tool classes, and some have ready-made components, such as springcloud open feign.
These things in common are communication.
The communication between different services involves many aspects, such as intranet access, Internet access, etc.
So how can microservices achieve internal communication (this refers to internal network communication, which cannot be accessed from the external network)? The core code is as follows (using interceptor mechanism): the if else code in the code can be placed in the database, NoSQL or configuration file.
After the interceptor mechanism is adopted, the URL of the corresponding feign component can be changed to the following (mainly the URL in the @ feignclient attribute):