What should I do if the parameters required by the gateway in the springcloud micro-service are not needed by the back-end service?

In

springcloud micro-service, the gateway needs to carry two parameters, one is accessToken and the other is version version number, but the backend service does not need these two parameters.

for example, the back-end service is originally like this

@RestController
public class OrderController{
    @RequestMapping
    public void add(Order order){
        ...
    }
}

in order to bring token and version to the request

@RestController
public class OrderController{
    @RequestMapping
    public void add(Order order String token, String version){
        ...
    }
}

it doesn"t feel good to add these two parameters to every method of the back-end service. Is there any way to deal with it?


I don't know when these two parameters are used
if you want to use RestTemplate, you can use the interceptor to add the parameter


Thank you for inviting me. I don't know much about spring-cloud

if the dubbo project is put into the configuration file and managed in XML, I wonder if you can refer to

.
Menu