Main {
DependencyNumberOne dependencyNumberOne = new DependencyNumberOne();
DependencyNumberTwo dependencyNumberTwo = new DependencyNumberTwo();
DependencyNumberThree dependencyNumberThree = new DependencyNumberThree();
ControllerOne controllerOne = new ControllerOne(dependencyNumberOne, dependencyNumberTwo, dependencyNumberThree);
ControllerTwo controllerTwo = new ControllerTwo(dependencyNumberOne, dependencyNumberTwo, dependencyNumberThree);
ControllerThree controllerThree = new ControllerThree(dependencyNumberOne, dependencyNumberTwo, dependencyNumberThree);
get("/routeOne", controllerOne)
get("/routeTwo", controllerTwo)
get("/routeThree", controllerThree)
}
class ControllerOne extends Controller {
public ControllerOne(DependencyNumberOne dependencyNumberOne, DependencyNumberTwo dependencyNumberTwo, DependencyNumberThree dependencyNumberThree) {
super(dependencyNumberOne, dependencyNumberTwo, dependencyNumberThree)
}
public Object handle() {
this.dependencyNumberOne.something();
this.dependencyNumberTwo.something();
}
}
class ControllerTwo extends Controller {
public ControllerTwo(DependencyNumberOne dependencyNumberOne, DependencyNumberTwo dependencyNumberTwo, DependencyNumberThree dependencyNumberThree) {
super(dependencyNumberOne, dependencyNumberTwo, dependencyNumberThree)
}
public Object handle() {
this.dependencyNumberOne.something();
}
}
class ControllerThree extends Controller {
public ControllerThree(DependencyNumberOne dependencyNumberOne, DependencyNumberTwo dependencyNumberTwo, DependencyNumberThree dependencyNumberThree) {
super(dependencyNumberOne, dependencyNumberTwo, dependencyNumberThree)
}
public Object handle() {
this.dependencyNumberOne.something();
}
}
Main {
static DependencyNumberOne dependencyNumberOne = new DependencyNumberOne();
static DependencyNumberTwo dependencyNumberTwo = new DependencyNumberTwo();
static DependencyNumberThree dependencyNumberThree = new DependencyNumberThree();
get("/routeOne", ControllerOne.doSomething)
get("/routeTwo", ControllerTwo.doSomething)
get("/routeThree", ControllerThree.doSomething)
}
class ControllerOne {
static Route doSomething = () -> {
dependencyNumberOne.something();
dependencyNumberTwo.something();
};
}
class ControllerTwo {
static Route doSomething = () -> { dependencyNumberOne.something() };
}
class ControllerThree {
static Route doSomething = () -> { dependencyNumberOne.something() };
}