public class AppContext extends BeanContainer
beanBuilders, beanExtractors, beanInjectors, beanInterceptors, SYNC_LOCK
构造器和说明 |
---|
AppContext() |
AppContext(java.lang.ClassLoader classLoader,
Props props) |
AppContext(SolonApp app,
java.lang.ClassLoader classLoader,
Props props) |
限定符和类型 | 方法和说明 |
---|---|
protected void |
beanComponentized(BeanWrap bw,
boolean delivered)
组件化处理
|
void |
beanDeliver(BeanWrap bw)
尝试 bean 交付(特定能力接口交付)
|
void |
beanExclude(java.lang.Class<?>... clzs)
排除扫描类(需要在扫描之前排除)
|
void |
beanExtractOrProxy(BeanWrap bw)
为一个对象提取函数或自动代理
|
void |
beanExtractOrProxy(BeanWrap bw,
boolean tryExtract,
boolean tryProxy)
为一个对象提取函数或自动代理
|
void |
beanImport(Import anno)
根据注解配置导入bean
|
void |
beanInject(java.lang.Object obj)
为一个对象注入(可以重写)
|
protected void |
beanInject(VarHolder vh,
java.lang.String name,
boolean required,
boolean autoRefreshed) |
BeanWrap |
beanMake(java.lang.Class<?> clz)
::制造 bean 及对应处理
|
void |
beanScan(java.lang.Class<?> source)
::扫描源下的所有 bean 及对应处理
|
void |
beanScan(java.lang.ClassLoader classLoader,
java.lang.String basePackage)
::扫描源下的所有 bean 及对应处理
|
void |
beanScan(java.lang.String basePackage)
::扫描源下的所有 bean 及对应处理
|
void |
clear() |
protected void |
initialize()
::初始化(独立出 initialize,方便重写)
|
boolean |
isStarted()
是否已启动
|
void |
lifecycle(int index,
int priority,
Lifecycle lifecycle)
添加生命周期 bean
|
void |
lifecycle(int index,
Lifecycle lifecycle)
添加生命周期 bean
|
void |
lifecycle(int index,
LifecycleBean lifecycle)
添加生命周期 bean(保持向下兼容)
|
void |
lifecycle(Lifecycle lifecycle)
添加生命周期 bean
|
void |
lifecycle(LifecycleBean lifecycle)
添加生命周期 bean(保持向下兼容)
|
void |
methodForeach(java.util.function.Consumer<MethodWrap> action)
遍历method (拿到的是method包装)
|
MethodWrap |
methodGet(java.lang.Class<?> clz,
java.lang.reflect.Method method)
获取方法包装(方便 aot 收集)
|
MethodWrap |
methodGet(java.lang.reflect.Method method)
获取方法包装(方便 aot 收集)
|
<T> AppContext |
onEvent(java.lang.Class<T> type,
EventListener<T> handler)
订阅事件
|
<T> AppContext |
onEvent(java.lang.Class<T> type,
int index,
EventListener<T> handler)
订阅事件
|
void |
prestop()
停止(一般在插件停止之后,再执行)
|
void |
start()
启动(一般在插件启动之后,应用完成扫描,再执行)
|
void |
stop()
停止(一般在插件停止之后,再执行)
|
protected int |
tryBuildBeanOfClass(java.lang.Class<?> clz)
根据类尝试生成 bean(用 protected,方便扩展时复用)
|
protected void |
tryBuildBeanOfMethod(BeanWrap bw,
java.lang.reflect.Method m,
Bean ma)
根据方法尝试生成 bean(用 protected,方便扩展时复用)
|
protected void |
tryBuildBeanOfMethod2(Bean anno,
MethodWrap mWrap,
BeanWrap bw,
java.lang.Object[] args) |
protected void |
tryInject(VarHolder vh,
java.lang.annotation.Annotation[] annS)
尝试为bean注入
|
protected void |
tryMethodParamsGather(AppContext context,
int label,
java.lang.Class<?> outType,
ParamWrap[] paramAry,
ConsumerEx<java.lang.Object[]> completionConsumer)
尝试方法参数收集
|
protected BeanWrap |
wrapCreate(java.lang.Class<?> type,
java.lang.Object bean,
java.lang.String name,
boolean typed)
生成 bean 包装
|
aot, app, attachGet, attachOf, attachSet, beanBasePublish, beanBaseSubscribe, beanBindingSupT, beanBuilderAdd, beanBuilderAdd, beanExtractorAdd, beanExtractorHas, beanFind, beanFind, beanForeach, beanForeach, beanHashPublish, beanHashSubscribe, beanInject, beanInjectorAdd, beanInjectorAdd, beanInjectProperties, beanInterceptorAdd, beanInterceptorAdd, beanInterceptorGet, beanInterceptorHas, beanInterceptorHas, beanRegister, beanRegisterSupI, beanStop0, cfg, copyTo, findConfigKey, getBean, getBean, getBeanAsync, getBeanAsync, getBeanOrNew, getBeansMapOfType, getBeansMapOfType, getBeansOfType, getBeansOfType, getClassLoader, getWrap, getWrapAsync, getWrapsOfType, hasWrap, putWrap, putWrap, removeWrap, removeWrap, subBeansOfType, subWrapsOfType, subWrapsOfType, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrapAndPut, wrapAndPut, wrapAndPut, wrapAndPut, wrapAndPut, wrapPublish
public AppContext()
public AppContext(java.lang.ClassLoader classLoader, Props props)
public <T> AppContext onEvent(java.lang.Class<T> type, EventListener<T> handler)
public <T> AppContext onEvent(java.lang.Class<T> type, int index, EventListener<T> handler)
public MethodWrap methodGet(java.lang.reflect.Method method)
method
- 方法public MethodWrap methodGet(java.lang.Class<?> clz, java.lang.reflect.Method method)
method
- 方法public void methodForeach(java.util.function.Consumer<MethodWrap> action)
action
- 遍历动作public void clear()
clear
在类中 BeanContainer
protected BeanWrap wrapCreate(java.lang.Class<?> type, java.lang.Object bean, java.lang.String name, boolean typed)
wrapCreate
在类中 BeanContainer
protected void initialize()
protected void beanComponentized(BeanWrap bw, boolean delivered)
bw
- bean 包装器delivered
- 要交付的(特定能力接口交付)protected void beanInject(VarHolder vh, java.lang.String name, boolean required, boolean autoRefreshed)
beanInject
在类中 BeanContainer
public void beanDeliver(BeanWrap bw)
bw
- Bean 包装public void beanExtractOrProxy(BeanWrap bw)
public void beanExtractOrProxy(BeanWrap bw, boolean tryExtract, boolean tryProxy)
tryExtract
- 尝试提取tryProxy
- 尝试代理public void beanInject(java.lang.Object obj)
public void beanExclude(java.lang.Class<?>... clzs)
public void beanImport(Import anno)
public void beanScan(java.lang.Class<?> source)
public void beanScan(java.lang.String basePackage)
public void beanScan(java.lang.ClassLoader classLoader, java.lang.String basePackage)
protected void tryInject(VarHolder vh, java.lang.annotation.Annotation[] annS)
protected void tryBuildBeanOfMethod(BeanWrap bw, java.lang.reflect.Method m, Bean ma) throws java.lang.Throwable
java.lang.Throwable
protected void tryMethodParamsGather(AppContext context, int label, java.lang.Class<?> outType, ParamWrap[] paramAry, ConsumerEx<java.lang.Object[]> completionConsumer)
protected void tryBuildBeanOfMethod2(Bean anno, MethodWrap mWrap, BeanWrap bw, java.lang.Object[] args)
protected int tryBuildBeanOfClass(java.lang.Class<?> clz)
public void lifecycle(LifecycleBean lifecycle)
public void lifecycle(int index, LifecycleBean lifecycle)
public void lifecycle(Lifecycle lifecycle)
lifecycle
在类中 BeanContainer
public void lifecycle(int index, Lifecycle lifecycle)
lifecycle
在类中 BeanContainer
index
- 顺序public void lifecycle(int index, int priority, Lifecycle lifecycle)
lifecycle
在类中 BeanContainer
index
- 顺序priority
- 优先级(此处,相当于二级顺序)public boolean isStarted()
public void start()
public void prestop()
public void stop()