[Post Construct] being run when service classes inherit from a class having Post Construct
As I have several areas of services for an AIR application I've chosen to split up my initial service class into sub classes which inherit
from a base class which has a meta tag [Post Construct].
As all being service classes they're mapped as 'mapSingletonOf'.
Now, the problem I detect is that the [Post Construct] seem to be run whenever the instansiation of the child classes occur
and it seems to 'corrupt' the singleton state of the parent?!?
Any one experienced similar behavior or do I simple do something wrong?
Comments are currently closed for this discussion. You can start a new one.
|?||Show this help|
|ESC||Blurs the current field|
|r||Focus the comment reply box|
|^ + ↩||Submit the comment|
You can use
Command ⌘ instead of
Control ^ on Mac
1 Posted by Chris on 26 Jul, 2013 06:49 AM
That is the behavour one would expect to happen when creating subclasses.
In the child class, override the method that has the [Post Construct] tag and make it do nothing.
2 Posted by hahn on 26 Jul, 2013 08:37 AM
True, that the parent class will be instantiated, but as being mapped as mapSingletonOf I would expect the container to return the already instantiated object,
hence, Post Construct wouldn't be run.
And the real problem is that I seem to get a new instance of the parent class.
I might try go for Composition instead :-)
Ondina D.F. closed this discussion on 30 Aug, 2013 07:57 AM.