import scaldi.Injectable; import scaldi.Module; import scaldi.Injector; class MyApp { @Injectable static class MyService { public void doSomething() { System.out.println("Doing something..."); } } static class MyModule extends Module { bind[MyService] to new MyService } public static void main(String[] args) { Injector.injector = new MyModule :: new val myService = inject[MyService] myService.doSomething() } }


上一篇:
下一篇:
切换中文