The idea is that I used with success another, more natural approach.
First of all I injected the needed services directly in Controller class:
importorg.springframework.beans.factory.annotation.Autowired;
importorg.springframework.stereotype.Component;
importro.pippo.controller.Controller;
importro.pippo.controller.Path;
@Path("/clients")
@ComponentpublicclassClientControllerextendsController {
@AutowiredprivateSubscriptionServicesubscriptionService;
@AutowiredprivateClientServiceclientService;
// GET, POST methods
}Add all controllers in Application after they were collected by Spring:
importorg.springframework.stereotype.Component;
importro.pippo.controller.ControllerApplication;
@ComponentpublicclassMyApplicationextendsControllerApplication {
@AutowiredprivateList<? extendsController> controllers;
@OverrideprotectedvoidonInit() {
addControllers(controllers.toArray(newController[controllers.size()]));
}
}The content of this issue is related somehow with #538.
The idea is that I used with success another, more natural approach.
First of all I injected the needed services directly in Controller class:
Add all controllers in Application after they were collected by Spring:
The content of this issue is related somehow with #538.