Dependency Injection experiment

Hi Andrew,

my first idea I had when looking at those new lazy delegates in Kotlin was also whether this can be made use of to get rid of Spring XML wiring boilerplate code that is hard to debug and sometimes hard to read (have to follow myriads of imports). Here is some very simple Spring wiring:

  <bean id="myBean" >   <property name="myVar" ref="someOtherBean"/>      </bean>

For the wiring to be done some reference to "someOtherBean" needs to be obtained. So you still need some kind of bean container that has a store with all the already created references and some wiring functionality. Lazy delegates alone won't do. Without lazy variables supported by the language you can still do something like this:

if(myVar == null) {   myVar = initMyVar() }

AFAIKS lazy delegates free you from having to write that kind of boilerplate code, but it doesn't free you from getting the wiring done somehow.

– Oliver