Skip to content

Commit

Permalink
修改 ioc 文档中有关复合加载器的一处错误
Browse files Browse the repository at this point in the history
  • Loading branch information
ywjno committed Aug 21, 2016
1 parent 56b4d22 commit 8ff16cf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
26 changes: 13 additions & 13 deletions doc/manual/ioc/ioc_loader.man
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"对象名称" : {
type : "对象类型",
parent : "被继承的对象名称",
parent : "被继承的对象名称",
events : {
fetch : "触发器的类型或者函数名",
create : "触发器的类型或者函数名",
Expand Down Expand Up @@ -60,7 +60,7 @@
parent : 'bean',

// 不声明,默认为 true
singleton : true,
singleton : true,

// 这里声明对象的三种事件。事件的处理函数可以是一个接口,也可以是自身的
// 一个方法。
Expand Down Expand Up @@ -131,31 +131,31 @@
在 org.nutz.ioc.meta.IocObject 类中,你如果拿到它的源代码,或者是 JDoc,它描述了在容器中一个对象的全部
信息,你会发现它其实也简单:

{{{
public class IocObject {
{{{<Java>
public class IocObject {

// 对象的 Java 类型
private Class<?> type;
private Class<?> type;

// 声明对象是否为单例
private boolean singleton;
private boolean singleton;

// 对象监听何种事件,对应有
// "fetch" - 每次对象被 ioc.get 的时候,触发
// "create" - 当且仅当对象被 new 的时候触发
// "depose" - 当对象被容器销毁时触发
private IocEventSet events;
private IocEventSet events;

// 对象构造函数的参数列表
private List<IocValue> args;
private List<IocValue> args;

// 对象的字段
private List<IocField> fields;
private List<IocField> fields;

// 对象的缓存范围,默认为 "app"
private String scope;
// 省略所有的 getter 和 setter 函数
private String scope;

// 省略所有的 getter 和 setter 函数
}}}

事件集合 IocEventSet
Expand Down Expand Up @@ -199,7 +199,7 @@

你的 IocLoader 的实现类需要实现三个方法:

{{{
{{{<Java>
public interface IocLoader {

/**
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/ioc/ioc_properties.man
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

如果是这样,那么 @Inject 可以这样写:
{{{
@Inject("java:$config.get('xxxxx')
@Inject("java:$config.get('xxxxx')")
private String myXXXX;
}}}

Expand Down
19 changes: 9 additions & 10 deletions doc/manual/ioc/loader_combo.man
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@
复合加载器非常简单,似乎只花了 Wendal 同学不到 1 个小时的时间,因为它本身并不做任何
事情,它只是调用其他的加载器:
{{{<Java>
@IocBy(type=ComboIocLoader.class, args={
"*js",
"ioc/dao.js",
"ioc/service.js",
"*anno",
"com.myapp.module",
"com.myapp.service",
"*tx",
"*async" // @Async注解,异步执行.
})
ComboIocLoader loader = new ComboIocLoader("*js",
"ioc/dao.js",
"ioc/service.js",
"*anno",
"com.myapp.module",
"com.myapp.service",
"*tx",
// @Async注解,异步执行.
"*async");
}}}
如上面的例子,组合加载器,组合了3个 Ioc 加载器,一个是 JsonLoader,一个是
AnnotationIocLoader, 一个是AOP事务的TransIocLoader(1.b.52新增)。
Expand Down

0 comments on commit 8ff16cf

Please sign in to comment.