Issue Details (XML | Word | Printable)

Key: SESPRINGACTIONSCRIPTAS-59
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Christophe Herreman
Reporter: Flávio Silva
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
SX Spring Actionscript

[singleton lazy-init] with dependency on [prototype lazy-init] - The prototype class is instantiated by 'preInstantiateSingletons()'

Created: 24/Jul/09 11:20 AM   Updated: 08/Sep/09 02:03 AM   Resolved: 03/Sep/09 03:42 AM
Component/s: IoC container
Affects Version/s: 0.8
Fix Version/s: 0.8.1

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive Spring-Actionscript-lazyinit01.zip (1.22 MB)

Environment:
Win Vista x64
FB3 - Flex SDK3.2
Flash Player 10.0.22.87 Debug


 Description  « Hide
Using the .as files as source, not .swc
Release 0.8 dowloaded by the svn at 2009-07-20
Flex Builder 3 - Flex SDK3.2 - ActionScript Project
Flash Player 10.0.22.87 Debug


The scenario is the following:

<object id="singletonClass" class="com.flsilva.samples.springextensions.actionscript.flash.lazyinit01.SingletonClass" lazy-init="true">
<property name="name">
<object class="org.springextensions.actionscript.ioc.factory.config.FieldRetrievingFactoryObject">
<property name="targetObject" ref="prototypeClass" />
<property name="targetField" value="propertyX" />
</object>
</property>
</object>

<object id="prototypeClass" class="com.flsilva.samples.springextensions.actionscript.flash.lazyinit01.PrototypeClass" lazy-init="true" scope="prototype" init-method="init" />

So the 'prototypeClass' is instantiated by 'preInstantiateSingletons()' because the 'singletonClass' has a dependency on 'prototypeClass'. If I remove this dependency, its not instantiated.
But both are lazy-init="true", so I think this is an issue. This occurs with or without the 'init-method' in the 'prototypeClass', which is called when it is present.
Also, the 'singletonClass' is not instantiated, but only its dependence ('prototypeClass').
This is done by the container in the boot time for check if the dependence is correct?
I think both are as lazy-init, this should not happen.

I am sending the sources so you can verify. It's pretty simple, with the FB3 ActionScript Project.
But one thing is pretty important:
Since I am working with the container, I found some problems and got myself settled, otherwise would be held here. Then you will see that the source that sent, several classes have been modified by me so that I could use the container (see the issues that I have sent, some were not yet resolved, and I just somehow addressing here). But I really think that the changes I made are off and not affect the core of the container. Also, please try to test with the official source for you to see if you can.

Let me know if I'm doing something wrong.

PS.: I was thinking these days that I have worked with the container, I am working on a personal framework based on the container and its extension to pureMVC. Its amazing and I really am enjoying very much. Based on this, is my total interest in the container is perfect, stable, no issues. I know that you guys are doing a very good job, but do not have all the time in the world. So I would propose to help more. Since I have solved some problems here and has really worked, I think I could help the best, publishing and collaborating in SVN.
I am a Flash developer with strong knowledge of OO, patterns, etc. I really like the heavy side of software development, is what made me become interested in the container. But I admit that the container is something that is beyond my knowledge. I have studied it and learned much (to dispel a little more each day), and I have given very good with him, solving problems and implementing my framework.
So, beta tester I am of course, I wonder if there was the possibility to collaborate with the development, solving some issues (which in fact some have even fixed).
So if interested tell me and we can talk about how, processes and so for me to work directly with the SVN.
My email: flsilva7@gmail.com

best regards
Flávio Silva

Flávio Silva added a comment - 24/Jul/09 04:56 PM
After a couple of hours investigating, I think I understood what happens.
Because I have a "<object class="org.springextensions.actionscript.ioc.factory.config.FieldRetrievingFactoryObject"> " element, it's treated like any other, what mean that it's being instantiated, because it's NOT flagged as lazy-init="true". So because it have an "dependency" to the'prototypeClass' (<property name="targetObject" ref="prototypeClass" /> ) it is instantiated too.
When I flag it, changing to <object class="org.springextensions.actionscript.ioc.factory.config.FieldRetrievingFactoryObject" lazy-init="true"> the problem is solved.

What I think about this is:
Since that FieldRetrievingFactoryObject in this case is an INNER object, with his parent ('singletonClass') flagged as lazy-init="true", it shouldn't be instantiated, as inheritor.
This should happen with any INNER object.

So let me know what you guys think about it.

Roland Zwaga added a comment - 02/Sep/09 04:38 PM
Fixed in trunk, added an XML preprocessor that looks for inner objects that are singletons and sets their lazy-init attribute to true