JdonFramework 6.0发布
使用Jdon框架6.0开发应用将变得异常简单,甚至无需XML配置文件,只需要两步:
第一步:将存在依赖关联关系的两个类用@Service或@Component(两者性质一致)标注:
@Service("helloService")
public class HelloServiceImpl implements HelloService
..
@Component
public class UserRepositoryInMEM implements UserRepository {
第二步:客户端调用代码:
HelloService helloService = (HelloService) WebAppUtil.getService("helloService", req);
String result = helloService.hello(myname);
无需jdonframework.xml配置文件和相关XML配置。DI依赖注射原理图见下:
全部演示代码见JdonFramework源码包目录下examples/testWeb
至此,Jdon框架业务层应用基本全部实现Annotation注解,Annotation做到少而精:
@Poolable 表示当前类的实例是从对象池中获得。
@Stateful 表示当前类的实例是与用户状态相关的。
@Singleton 表示当前类的实例是单例。
如果没有以上注解,缺省当前类的实例相当于new,每次请求一次。
以上几种类的创建模式在性能上,对于代码小的类差别都不大,已经经过测试。响应在70毫秒左右。
@Model 是用来对领域模型进行注解。
下载页面:
http://www.jdon.com/jdonframework/download.html
[该贴被admin于2009-07-20 17:41修改过]