jasperblues/Typhoon — pull request #29 by RomainLo (2013-07-07 21:04:55+00:00)
Title: Configuration for lazely-instantiated components

Hi,

First of all, thanks for the cool stuff that you have done! I want to propose improvements on the singleton instantiations.

### Pre-instantiation of the singletons
Within the IoC container of Spring, the components scoped as singleton are pre-instantiated by default. As [the documentation](http://static.springsource.org/spring/docs/2.0.8/reference/beans.html#beans-factory-lazy-init) explains it: _this is a good thing, because it means that any errors in the configuration or in the surrounding environment will be discovered immediately_. For this reason, I have changed few parts of the TyphoonComponentFactory for allowing to instantiate each singleton in a lazy way or not.

### Configuration for lazely-instantiated components
I propose to configurate the instantiation (lazy or not) of the singletons via the XML files:
there are some modifications on the TyphoonRXMLElement's category for checking the attribute named 'lazy-init' on the 'component' nodes. The value of 'lazy-init' is set to the TyphoonDefinition property named 'isLazy'. Then this value is used in the TyphoonComponentFactory methods for the instantiations.

```xml

Should be interpreted as a lazy singleton.

```

I hope that you will appreciate this pull request.

Cheers,
Romain