Montag, 21. Juli 2014

Why Spring makes me sick #14

While investigating Spring I have written numerous test with seemingly independent configurations. But a couple of times adding new tests unexpectedly broke tests e.g. because I added a second bean of a certain type, but in an older test Spring expected only one bean of that type.

Is that my fault? Strictly speaking: Yes, because I must e.g. not autowire a single bean, when more are defined.

BUT if I run into this problem, namely breaking the application by adding another bean, for my tests, which are not that much code and only I work on, imagine how many problems this can create, when multiple developers work on a large code base.

What really makes this bad is, that due to the 'dynamic' way spring is configured, such problems may not occur in the test suite, but only in production code. And since Spring errors only turn up at run time, combined with lazy initialization this is a time bomb.
Oh, and good luck finding and solving such a problem in a complex Spring configuration.

Keine Kommentare:

Kommentar veröffentlichen