I have a usecase where every single HTTP request to my SpringBoot app will contain an id in a header. I need to call an internal service to retrieve informations stored in my database based on that id; those informations will then be used inside my services called by the RestControllers.
I've thought about using Interceptors, but even though those will allow me to call my service and retrieve informations in the DB, there's no way in my knowledge to forward that object to my business services. Another path I've explored is through AOP. But while you can inside your aspects retrieve informations of the method that calls you, I don't think you can access data retrieved by the aspect inside the annotated method.
Is there any way to do this properly without using @RequestHeader and calling my service by hand in every single RestController's method (thus duplicating a ton of code) ?
Thanks !