Hi I ran into a problem while trying to shift my cairngorm based app to spring AS.
I use inheritance in my commands which solves a number of problems. assuming each of my commands reference a relevant model and service. I have hundreds of commands in my application grouped under dozens different features, each feature has a different model\service. I use a base command class in order to eliminate the need to state dependencies on each command, in the base command I declare and set the service and model. here's a sample from the login feature:
next I will haveCode:public class BaseLoginCommand implements Responder, Command { public var service:LoginServiceLocator; public var model:LoginModelLocator; public function BaseLoginCommand() { //get instances LoginService = LoginServiceLocator.getInstance(); model = LoginModelLocator.getInstance(); }
My current problem is that CairngormFrontController creates an empty instance of LoginCommand it would not inject the model or service. I've looked into the frameworks code and would be happy to assist in solving this issue. As far as I can see I will need to reference the application context and request a new instance LoginCommand, is this possible or does springAS only includes support for creation of singletons.Code:public class LoginCommand extneds BaseLoginCommand { public override function execute(event:CairngormEvent):void { //reference the entities from the super class service.doSomething()
I would be happy to hear peoples opinions regarding this,
Lior.


Reply With Quote
