Hello everyone,
I have a restful resource that fetch common anagraphics data from a table, and provides additional information based on them by calling the specified service in the table (In a fqdn form):
name
surname
service
John
Doe
\app\serviceA
Jane
Doe
\app\serviceB
Those service share a common interface, have their own factories and configurations, and provides different clients for different requests under common interface names.
Because of their dependencies, I can’t instantiate them on the fly and I need to preload all of them inside the resource factory.
I was wondering if there’s a way, like a middleware or an event, to dynamically load only the specific adapter needed and not all of them from the resource factory.
The information that there is an HTTP request at all should not be brought to other layers. Only controllers or request handlers should be aware of this.
A custom plugin manager might be suitable for your use case: