public class ServletContextDependencySupplier extends BaseDependencySupplier
ServletContext.
Instance of object must be present in servlet context as attribute with name
which is the same as class or interface name of requested parameter, e.g.
instance of org.foo.bar.MyClass must be bound to attribute name
org.foo.bar.MyClassinjectAnnotationClass, nameDetector| Constructor and Description |
|---|
ServletContextDependencySupplier(javax.servlet.ServletContext ctx) |
ServletContextDependencySupplier(javax.servlet.ServletContext ctx,
Class<? extends Annotation> injectAnnotation) |
| Modifier and Type | Method and Description |
|---|---|
Object |
getComponent(Class<?> type)
Get instance of
type. |
Object |
getComponentByName(String name)
Get instance of dependency by name.
|
getComponent, getProvider, isProviderpublic ServletContextDependencySupplier(javax.servlet.ServletContext ctx,
Class<? extends Annotation> injectAnnotation)
public ServletContextDependencySupplier(javax.servlet.ServletContext ctx)
public Object getComponent(Class<?> type)
DependencySuppliertype.type - required parameter classtype may not be producedpublic Object getComponentByName(String name)
BaseDependencySuppliernull.
Override it if back-end (e.g. IoC container) supports getting components by key (name).getComponentByName in class BaseDependencySuppliername - of dependencyname may not be producedCopyright © 2012–2016 Codenvy, S.A.. All rights reserved.