Interface InjectionService
-
- All Superinterfaces:
PlaceholderResolver
,Service
public interface InjectionService extends Service, PlaceholderResolver
Dependency injection service.Overview
This interface represents the abstraction layer of dependency injection capabilities that are provided by an underlying IoC container like Spring Framework. Typically this service is used for injecting dependencies into objects that were received from some external sources (f.e. deserialized from a socket).
Accessing the Service
InjectionService
is available only ifHekate
instance was constructed via framework-specific bootstrap class (like HekateSpringBootstrap). Availability of this service can be checked viaHekate.has(Class)
method. If service is available then it can be accessed viaHekate.get(Class)
as in the example below:InjectionService injection = hekate.get(InjectionService.class);
Enabling Injection
In order to enable injection the
HekateInject
annotation must be added to a class who's dependencies should be injected. Classes that do not have this annotation will be ignored by theInjectionService
.Injectable Components
The following components can can be injected:
Hekate
instance that manages this service.- All
services
that are registered within theHekate
instance - Any other components that are managed by the underlying IoC framework (f.e. beans from Spring Framework application context)
Note: this service performs injection of fields/properties only. Other extended capabilities (like lifecycle management) that can be provided by an underlying IoC container are not supported.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
inject(Object obj)
Injects dependencies into the specified object.-
Methods inherited from interface io.hekate.core.inject.PlaceholderResolver
resolvePlaceholders
-
-
-
-
Method Detail
-
inject
void inject(Object obj)
Injects dependencies into the specified object.- Parameters:
obj
- Dependent object.
-
-