Skip to content

Remove pippo-spring module from next major version of Pippo  #565

@decebals

Description

@decebals

The idea is that I used with success another, more natural approach.
First of all I injected the needed services directly in Controller class:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ro.pippo.controller.Controller;
import ro.pippo.controller.Path;

@Path("/clients")
@Component
public class ClientController extends Controller {

    @Autowired
    private SubscriptionService subscriptionService;

    @Autowired
    private ClientService clientService;

    // GET, POST methods

}

Add all controllers in Application after they were collected by Spring:

import org.springframework.stereotype.Component;
import ro.pippo.controller.ControllerApplication;

@Component
public class MyApplication extends ControllerApplication {

    @Autowired
    private List<? extends Controller> controllers;

    @Override
    protected void onInit() {
        addControllers(controllers.toArray(new Controller[controllers.size()]));
    }

}

The content of this issue is related somehow with #538.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions