I'm trying to make a post request but I'm getting a strange error.
No primary or default constructor found for interface java.util.List
clients,accounts and transactions are normal arrays (typescript doesn't have list) but this should work i guess.
Do I really need to get Client[],etc... and then convert to list in the controller? doesn't make much sense.
Code:
Request
createEnvironment(environment,clients,accounts,transactions) {
const params = new HttpParams()
.set("environment", environment)
.set("clients", clients)
.set("accounts", accounts)
.set("transactions",transactions)
.set("isCloned", "false");
console.log(params);
return this._http.post<any>(RequestProperties.baseUrl + "/environment/create", params, this.options);
}
Spring
@PostMapping("/environment/create")
public boolean createEnvironment(Environment environment, List<Client> clients, List<Account> accounts,
List<Transaction> transactions,boolean isCloned) {
environmentService.createEnvironment(environment,clients,accounts,transactions, isCloned);
return true;
}
edit:
Well, even with Client[],etc.. I get
No primary or default constructor found for class [com.myproject.models.Client;