SpringBoot @ReuquestParam value assignment




Hello,

When we want to assign a default value to a function, we usually use it as follows.

public List<Data> getAllData(int page=0, int size=100)

However, this is not the case with @RequestParam with SpringBoot. 

public List<Data> getAllData(@RequestParam int page=0, @RequestParam int size=100)

When we try to assign as follows, we encounter the following warning.



Here we have to make the assignment as follows.

public ResponseEntity<CustomPage<Faqs>> getAll(@RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "5") int size){


Yorum Gönder

0 Yorumlar