简单的Java IoC容器:green-forest
jopen
12年前
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); } }