Iky Container is an IoC 'proof of concept' framework, still at an early stage, but mature enough to provide those features :
// Instanciate a container named "myContainer"
ContainerI container = new DefaultContainer("myContainer");
// Register a component under it's fully qualified class name container.registerComponentImplementation(MyClass.class);
// Register component under an alias container.registerComponentImplementation(MyClass.class, "myClass");
// Register an instance Object obj = new Object(); container.registerComponentInstance(obj);
// Retrieve objects MyClass = (MyClass) container.retrieveComponentInstance(MyClass.class)
An XML definition file for a container looks like this :
<container>
<!-- Containers Definition -->
<containers>
<container>
<name>Internal Services</name>
<classname>net.wmind.container.DefaultContainer</classname>
<loadOnStartup>true</loadOnStartup>
</container>
</containers>
<!-- Component Definition -->
<components>
<component>
<name>Internationalization Service</name>
<classname>net.wmind.iky.i18n.ResourceBundleService</classname>
<alias>net.wmind.commons.PropertyResourceHelperI</alias>
<loadOnStartup>true</loadOnStartup>
</component>
<component>
<name>Local Console Service</name>
<classname>net.wmind.iky.console.Console</classname>
<loadOnStartup>true</loadOnStartup>
</component>
</components>
</container>
It defines a container named "Internal Services" that registers two components, "Internationalization Service" and "Local Console Service". The container is created this way :
ComponentFactoryI factory = new XmlContainerFactory("someXmlFile.xml");
ContainerI container = (ContainerI) factory.retrieveInstance();
See the javadoc for the whole possibilities.