AresFramework,支持IOC、AOP、MVC功能:
IOC:支持Component、Resource、Scope注解,按名-按类型方式注入;
AOP:支持Aspect、Pointcut、Order注解,使用JDK动态代理,支持切面排序;
MVC:支持Controller、RequestMapping、ResponseData注解,支持普通参数,String数组注入,支持JSP、JSON视图解析。
软件核心类:
ResolverLoader、BeanFactory、FactoryBean、Dispatcher、HandlerAdapter、ViewResolver。
代码示例
@Component("Aop")publicclassAopImplimplementsAop{@ResourceprivateIocComponentic;publicvoidaopTest(){System.out.println("invoke");}}@Aspect@Order(1)publicclassAopInterceptorextendsAbstractHandlerInterceptor{@Override@Pointcut("frame.test.Aop.aopTest")publicvoidinvokeBefore(Objecttarget,Methodmethod,Object[]args){System.out.println("before"+"target"+target.toString()+"method"+method.toString()+"args"+args);}@Override@Pointcut("frame.test.Aop.aopTest")publicvoidinvokeAfter(Objecttarget,Methodmethod,Object[]args){System.out.println("after"+"target"+target.toString()+"method"+method.toString()+"args"+args);}}@Controller("/simple")publicclassSimpleAction{@ResponseData("JSON")@RequestMapping("/json.do")publicStringgetJson(intid,Stringname){return"{"+id+","+name+"}";}@RequestMapping("/jsp.do")@ResponseData("JSP")@ResponseMapping("/WEB-INF/jsp/hello")publicStringgetJsp(intid,Stringname){return"{"+id+","+name+"}";}@RequestMapping("/jsp2.do")@ResponseData("JSP")publicStringgetJsp2(intid,Stringname){return"/WEB-INF/jsp/hello";}}
评论