简单的Java IoC容器:green-forest
Green-forest Framework是一个简单的 IoC 容器,拥有Action-Handler architecture架构。示例:
//create Green-forest Engine Engine engine = new Engine(); //register some handler engine.putHandler(SomeActonHandler.class); //invoke some action and get result String result = engine.invoke(new SomeAction("some data")); //implement a business logic @Mapping(SomeAction.class) public class SomeActonHandler extends Handler<SomeAction>{ @Inject SomeService service; public void invoke(SomeAction action) throws Exception { String input = action.getInput(); String result = service.someWork(input); action.setOutput(result); } }
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!