//Repository List<Person> findByEyeColorAndAgeLessThan(String eyeColor, Integer age); //Controller @GetMapping("/people/search") public List<Person> searchPeople( @RequestParam(name = "eyeColor", required = false) String eyeColor, @RequestParam(name = "maxAge", required = false) Integer maxAge ) { if (eyeColor != null && maxAge != null) { return this.personRepository.findByEyeColorAndAgeLessThan(eyeColor, maxAge); } else if (eyeColor != null) { return this.personRepository.findByEyeColor(eyeColor); } else if (maxAge != null) { return this.personRepository.findByAgeLessThan(maxAge); } else { return new ArrayList<>(); } }