I am exposing an API, and I extract a client parameter from the request header.
This parameter is then used from the business logic, to apply customer-specific rules, down to the connection layer, where it drives which external system I will call.
We are having discussions with a colleague on whether we should use a request scoped bean to store this parameter and make it readily available everywhere in the stack, or whether we should pass this value down as a method argument, or a mix of both.
The request-scoped bean is simple - you store the value and can access it everywhere. On the other hand, you hide the actual needs of your services by not exposing the actual parameters it needs.
Are there best practices in this case? How would you handle this situation?
Aucun commentaire:
Enregistrer un commentaire