Getting below error while calling request with multiple parameter in get request : http://localhost:8080/find/1/empid/146220
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Aug 01 19:33:35 IST 2017 There was an unexpected error (type=Internal Server Error, status=500). Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named parameters, on JDK 8 or better, be sure to compile with -parameters.; nested exception is java.lang.IllegalArgumentException: Name for parameter binding must not be null or empty! On JDKs < 8, you need to use @Param for named parameters, on JDK 8 or better, be sure to compile with -parameters.
Demo.java
@Entity
public class Demo {
@Id
private Long id;
private String name;
private String value;
//getter -setter
}
DemoApplication.java
@SpringBootApplication
@RestController
public class DemoApplication {
@Autowired
private DemoRepository repository;
@RequestMapping(method=RequestMethod.GET, value="/find/{id}/{name}/{value}")
public Demo find(@PathVariable Long id, @PathVariable String name, @PathVariable String value){
return repository.findByIdAndNameAndValue(id, name, value);
}
}
DemoRepository.java
public interface DemoRepository extends CrudRepository<Demo, Long>{
@Query("select d from Demo d where d.id = :id and d.name = :name and d.value = :value")
Demo findByIdAndNameAndValue(Long id, String name, String value);
}