Package net.reevik.mikron.ioc
Class MikronContext
java.lang.Object
net.reevik.mikron.ioc.MikronContext
- All Implemented Interfaces:
AutoCloseable
Mikron context is the inversion-of-control container, which control the life-cycle of the mikron
managed instances.
MikronContext
instance is managed itself, even though it's not
annotated with Managed
so it can be injected in your application code.- Author:
- Erhan Bagdemir
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
findImplementingManagedInstances
(Class<?> parentType) Find and return the implementing managed instances.getConfiguration
(String configurationSourceKey) <T> Optional
<T> getInstance
(String name) static MikronContext
void
Registers a new managed instance explicitly, which makes the context rescan the packages so that the new managed instance can be wired.
-
Method Details
-
init
-
register
Registers a new managed instance explicitly, which makes the context rescan the packages so that the new managed instance can be wired.- Parameters:
instance
- Which is registered manually in the current context.name
- The managedInstanceName of the managed instance.
-
getManagedInstances
-
getInstance
-
getPropertiesRepository
-
getConfiguration
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
findImplementingManagedInstances
Find and return the implementing managed instances.- Parameters:
parentType
- Parent type, e.g., an interface declaring a concrete managed instance.- Returns:
- All implementing concrete managed instances.
-