Alex Rivera | Logout

Doesn't Spring's dependency injection break information hiding?

Asked 2009-03-09T20:06:37.550
14

Coming from a C++ background I have to master the complexity of the Java world and its frameworks. Looking at the spring framework for DI I am finding it difficult to believe that I have to make each setter function which will be subject for DI public. Doesn't that requirement break the principle of information hiding?

Of course I want spring to be able to set some private parts of my classes, but I certainly do NOT want every client class to be able to do the same.

What am I missing here?

Edit
Report

1 Answer

0

Just wanted to mention that I've (inadvertently) posted a more generic version of this question and that it has some further insights into the issue: Must Dependency Injection come at the expense of Encapsulation?

answered 2009-06-18T19:08:23.667

Your Answer