AresFramework,实现 IOC、AOP 和 MVC 框架 AresFramework

码农软件 · 软件分类 · 服务框架/平台 · 2019-09-25 17:12:12

软件介绍

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")
public class AopImpl implements Aop {
	
	@Resource
	private IocComponent ic;
	
	public void aopTest() {
		System.out.println("invoke");
	}
	
}
@Aspect
@Order(1)
public class AopInterceptor extends AbstractHandlerInterceptor {

	@Override
	@Pointcut("frame.test.Aop.aopTest")
	public void invokeBefore(Object target, Method method, Object[] args) {
		System.out.println("before " + "target " + target.toString() + " method " + method.toString() + " args " + args);
	}

	@Override
	@Pointcut("frame.test.Aop.aopTest")
	public void invokeAfter(Object target, Method method, Object[] args) {
		System.out.println("after " + "target " + target.toString() + " method " + method.toString() + " args " + args);
	}
	
}
@Controller("/simple")
public class SimpleAction {

	@ResponseData("JSON")
	@RequestMapping("/json.do")
	public String getJson(int id, String name) {
		return "{" + id + ", " +name +"}";
	}
	
	@RequestMapping("/jsp.do")
	@ResponseData("JSP")
	@ResponseMapping("/WEB-INF/jsp/hello")
	public String getJsp(int id, String name) {
		return "{" + id + ", " +name +"}";
	}
	
	@RequestMapping("/jsp2.do")
	@ResponseData("JSP")
	public String getJsp2(int id, String name) {
		return "/WEB-INF/jsp/hello";
	}
	
}

本文地址:https://www.codercto.com/soft/d/15385.html

Math Adventures with Python

Math Adventures with Python

Peter Farrell / No Starch Press / 2018-11-13 / GBP 24.99

Learn math by getting creative with code! Use the Python programming language to transform learning high school-level math topics like algebra, geometry, trigonometry, and calculus! In Math Adventu......一起来看看 《Math Adventures with Python》 这本书的介绍吧!

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具