问题
I'm using Quarkus version 1.5.1, however when trying to send data of type LocalDate (or Date) of a form, it returns the following error message:
java.lang.RuntimeException: RESTEASY007545: Unable to find a MessageBodyReader for media type: text / plain; charset = us-ascii and class type java.time.LocalDate
I have already imported the following dependencies, but the error persists.
<dependency>
<groupId> io.quarkus </groupId>
<artifactId> quarkus-resteasy </artifactId>
</dependency>
<dependency>
<groupId> io.quarkus </groupId>
<artifactId> quarkus-resteasy-jsonb </artifactId>
</dependency>
<dependency>
<groupId> io.quarkus </groupId>
<artifactId> quarkus-resteasy-jaxb </artifactId>
</dependency>
<dependency>
<groupId> io.quarkus </groupId>
<artifactId> quarkus-resteasy-jackson </artifactId>
</dependency>
Here is the code: - Controller
@POST
@Consumes (MediaType.MULTIPART_FORM_DATA)
@Produces (MediaType.APPLICATION_JSON)
@Transactional
@Path ("/ new")
public Response addSessao (@MultipartForm @Valid Sessao sessao) {
sessionService.insert (session);
return Response.seeOther (URI.create ("/ sessions")). build ();
}
- Entity
@Column (name = "data_inicio_sessao")
@FormParam ("data_inicio_sessao")
public LocalDate dataInicioSessao;
@Column (name = "data_fim_sessao")
@FormParam ("data_fim_sessao")
public LocalDate dataFimSessao;
来源:https://stackoverflow.com/questions/62420547/quarkus-error-sending-form-data-with-date-field