I am trying to pass an argument to my @RESTController Spring Boot class.
In the @POSTMapping method I want to use a method of a self defined Java class for processing the received body and returning a response.
The Spring application is launched in Application.java. The Controller-Object seems to get created implicitly.
I already tried adding a constructor to my RESTController class. But I couldn't find a way to call that constructor with an argument.
// Application.java
public static void main (String[] args) {
    SpringApplication.run(Application.class, args);
}
//ConnectorService.java
@RestController
public class ConnectorService {
    private Solveable solver;
    public ConnectorService() {}
    public ConnectorService (Solveable solveable) {
        this.solver = solveable;
    }
    @CrossOrigin(origins = "http://localhost:3000")
    @PostMapping(path =  "/maze")
    public Solution Test(@RequestBody Test test) {
       return solver.solve(test);
    }
}
Even though i could define a second constructor, i didn't find any way to call it with my Object.
 
     
     
    