我有一个名为的简单POJO Check
.我有一个简单的休息库:
@RepositoryRestResource(collectionResourceRel = "check",path = "check")
public interface RestCheckRepo
extends JpaRepository<Check,Integer> {
public List<Check> findByShopName(@Param("shop") String shop);
public List<Check> findByDateTime(@Param("dt")Date dt);
public List<Check> findByShopNameAndDateTime(@Param("shop")String shop, @Param("dt")Date dt);
public List<Check> findByShopNameAndDateTimeBetween(@Param("shopName") String shop,
@Param("start")Date t1,
@Param("end") Date t2);
}
Run Code Online (Sandbox Code Playgroud)
一切正常!! 但我不知道如何使用java.util.Date
as 实现请求处理程序@RequestParam
.示例:http:// localhost:8080/check/search/findByDateTime?dt = {value}
UPDATE 请求 http:// localhost:8080/check/search/findByDateTime?dt = 2015-08-10T13:47:30 --->响应:
{
"cause": {
"cause":null,
"message":null
},
"message":"Failed to convert from type java.lang.String to type @org.springframework.data.repository.query.Param java.util.Date for value '2015-10-07T15:04:46Z'; nested exception is …
Run Code Online (Sandbox Code Playgroud)