I am writing a Java Spring REST server using Spring Boot. This is the dependency list:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
</dependencies>
This is a part of my a controller class:
@RequestMapping(path = "/", method = RequestMethod.GET)
public GenericResponse<List<Trip>> getUserTrips(Pageable pageable , @RequestParam("owner") String owner) {
List<Trip> trips = tripRepository.findByOwner(owner , pageable);
for (Trip trip : trips) {
Link link = linkTo(methodOn(TripController.class).getTripInfo(trip.getTripId())).withSelfRel();
trip.add(link);
}
return new GenericResponse<List<Trip>>(200, "Success", trips);
}
When compiled, I got the following error:
method getUserTrips in class com... cannot be applied to given types required org.sptringframework.data.domain.Pageable, java.lang.String found: java.lang.String reason: actual and formal argument lists differ in length
I don't understand. I thought Pageable automatically parse the ?page=x&pageSize=y to the pageable var.
Do I forget to add any dependencies? What is wrong?
I do not use WebMv (it's not in my dependency list) Is it why this does not work?