Возникла проблема при настройке функции Moxy Json от функции Джексона до приложения Springboot + Jersey.
Изменения сделаны -
В расширенном классе ResourceConfig -
//register(JacksonJsonProvider.class); #Commented
register(MoxyJsonFeature.class);
В файл Pom.xml добавлено следующее -
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.23.2</version>
</dependency>
API
@Produces(MediaType.APPLICATION_JSON)
@Path("/")
@Api(value = "xyz")
public class XyzController {
@GET
@Path(Urls.XYZ)
@ApiOperation(value = "xyz", notes = "xyz", nickname = "xyz")
public Long xyz(@Valid @BeanParam final FetchParams fetchParams) {
return testService.xyz(fetchParams);
}
}
Исключение для API -
Caused by: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/json, type=class java.lang.Long, genericType=class java.lang.Long.
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:247)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)