Lets imagine that we have a large data structure (lets call it Configuration
) and various client classes (lets call them Services
). Each service needs just one or two fields from Configuration
.
If we inject the whole Configuration
object to the various Service
s, does this violate the ISP?
Does the fact that Configuration
is technically a data structure and not a literal Java interface change the fundamental point behind ISP?
The practical dilemma I am facing is how configuration should become available to the various parts of my system. I have the option to use Spring's @Value
annotation, through which each component gets precisely what it needs and nothing more. My second option is to make a Configuration
instance available as a whole. In the second case, every component of the system would get the configuration of the whole system instead of getting only the few parts that it actually needs.
I am trying to understand whether the second option violates ISP.