java - API 中的 LocalDate 作为 javax.ws.rs.QueryParam
问题描述
我想使用LocalDate
as @QueryParam
,但我收到编译时错误 as
Incorrect parameter type
Inspection info: Checks types of parameters annotated @PathParam, @QueryParam, etc. The type of the annotated parameter, field or property must either:
Be a primitive type.
Have a constructor that accepts a single String argument.
Have a static method named valueOf or fromString that accepts a single String argument (see, for example, Integer.valueOf(String)).
Have a registered implementation of ParamConverterProvider JAX-RS extension SPI that returns a ParamConverter instance capable of a "from string" conversion for the type.
Be List<T>, Set<T> or SortedSet<T>, where T satisfies 2, 3, or 4 above. The resulting collection is read-only.
我在我的资源类中使用如下
@QueryParam("lastLoginStartDate") LocalDate startDate
有什么方法可以在 API 中使用LocalDate
吗javax.ws.rs.QueryParam
?
解决方案
推荐阅读
- java - 从 java 调用 python 代码:askopenfilename 不起作用
- ffmpeg - FFmpeg/FFprobe - 检测空白/空/白色图像
- api - 获取发送到电子邮件或短信的公共 API 的响应
- c++ - 在 C/C++ 中从模数和指数生成 RSA 公钥
- javascript - 对象上 lodash 变换的替代管
- javascript - 在JSP中单击复选框提交表单
- python - 将(字符串)列表中的每个元素附加到 Python 中另一个(字符串)列表中的每个元素
- reactjs - NextJS API 路由与 Firebase 云函数
- rasa - NLU训练需要很长时间
- sql - SCD 类型 2 的 SQL 查询