Configuration for lazely-instantiated components #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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.
I hope that you will appreciate this pull request.
Cheers,
Romain