Hacker News new | ask | show | jobs
by galuvian 4553 days ago
Auto wiring is great for test code. Most of you need to know about the test is contained in the testing class.

But I don't like using auto wired in the main code because it means I am required to use that wiring for every use. I find that we want to use classes in a few different ways, and keeping the dependency definitions and configuration values in the XML decouples it from the code and increases both reusability as well as exposing the XML configurations after deployment so that a recompile isn't required in the field.

1 comments

I've never configured DI after deployment. Can you show a use case when it makes sense?
Different DB drivers and connection pool setups for example.

Taken to extremes I've also used Spring to configure a rudimentary ETL framework for example, where the entire pipeline could be (re-)configured post release.

Well, that seems to be a special case. You still do not need to move 99% of your wiring out of your app.