Skip to content
This repository

Merge pull request #87 from bysse/master

Added a default, throwing, case to ConstructorInjectionPoint

Triggered by constructors with more than 10 arguments.
latest commit 4205e4e437
Till Schneidereit authored
Octocat-spinner-32 build Changes all none-filename mentions of `SwiftSuspenders` to `Swiftsusp… December 23, 2011
Octocat-spinner-32 src Throw an exception if the class couldn't be instantiated. March 21, 2013
Octocat-spinner-32 test Test exposing a bug in MethodInjectionPoint January 31, 2013
Octocat-spinner-32 .gitattributes added gitattributes November 03, 2009
Octocat-spinner-32 .gitignore re-introduces June 02, 2012
Octocat-spinner-32 CONTRIBUTORS.textile Added list of contributors November 20, 2009
Octocat-spinner-32 Gemfile updating November 08, 2011
Octocat-spinner-32 Gemfile.lock updating November 08, 2011
Octocat-spinner-32 LICENSE Added LICENSE file and changed all class files to only contain a shor… November 12, 2009
Octocat-spinner-32 adding maven read me November 02, 2011
Octocat-spinner-32 Replaced README by a stub for version 2. October 28, 2011
Octocat-spinner-32 SwiftSuspendersConfigurationSchema.xsd Adding an XML schema file for the validation of injector configuratio… May 04, 2011
Octocat-spinner-32 Major revision to implement fallbackProviders. October 05, 2012
Octocat-spinner-32 build.xml Increases version to 2.0.0rc1 June 08, 2012
Octocat-spinner-32 buildfile Increases version to 2.0.0b3 December 28, 2011
Octocat-spinner-32 Added usage example for ClassProvider. October 05, 2012
Octocat-spinner-32 maven-runonce.bat adjusting the WinX batch script November 07, 2011
Octocat-spinner-32 adding runonce dependency install scripts November 02, 2011
Octocat-spinner-32 pom.xml Maven build January 31, 2013
Octocat-spinner-32 settings.xml adding maven POM and settings November 02, 2011
Octocat-spinner-32 re-introduces June 02, 2012


Attention: This README is just a stub to prevent you from reading the heavily outdated one for Swiftsuspenders 1.x.

That being said, here's a very quick outline of the new version's capabilities and API:


  • injection requests configurable using standardized metadata
  • can inject into vars, setters, methods and constructors
  • injection requests can be optional
  • mapping dependencies by class and, optionally, name
  • satisfying dependencies using value, class instance, singleton or custom providers
  • chaining multiple injectors to create modular dependency-mapping graphs much like inheritance works in OOP
  • defining local and shared scope for mappings, akin to public and private members of a class
  • defining soft mappings that only get used if no injector higher up in the inheritance chain can satisfy a dependency
  • support object live-cycle management (note: The latter part of that management, i.e. the destruction, is not yet implemented, but will be for 2.0 final)



Requests, aka injection points, can be defined using the metadata tag [Inject] atop the var, setter or method to inject into. For constructor injection, no metadata is required.

Named injections can be defined using the syntax [Inject(name="injection name")]. In this case, constructors have to have their metadata placed atop the class itself, not the constructor. This is a limitation of the Flex compiler.

Optional injection requests can be defined using the syntax [Inject(optional=true)]


The API is expressed as a DSL to make very fine-grained configuration of each mapping easy and readable:

const injector : Injector = new Injector;

//create a basic mapping:; //will instantiate a new Sprite for each request for Sprite

//map to another class:; //will instantiate a new BetterSprite for each request for Sprite

//map as a singleton:; //will lazily create an instance and return it for each consecutive request

//map an interface to a singleton:;


So, that's it for now as far as documentation is concerned. The implementation, on the other hand, is very stable and shouldn't regress anything that used to work in 1.x, as long as the API changes are dealt with, of course.

More documentation will soon come here, in the github wiki and as asdocs.

Something went wrong with that request. Please try again.