Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration for lazely-instantiated components #29

Merged
merged 3 commits into from
Jul 7, 2013

Conversation

RomainLofaso
Copy link
Contributor

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.

<component class="Knight" key="lazySingleton1" lazy-init="true" scope="singleton">
    <description>
    Should be interpreted as a lazy singleton.
    </description>
</component>

I hope that you will appreciate this pull request.

Cheers,
Romain

jasperblues added a commit that referenced this pull request Jul 7, 2013
Configuration for lazely-instantiated components
@jasperblues jasperblues merged commit ccfd371 into appsquickly:master Jul 7, 2013
@jasperblues
Copy link
Member

Great work Romain - thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants