Java 如何让应用程序代码使用Gson并让执行器使用Jackson?
我理解,通过使用致动器,我们必须使用Jackson而不是Gson:Java 如何让应用程序代码使用Gson并让执行器使用Jackson?,java,spring-boot,gson,spring-boot-actuator,Java,Spring Boot,Gson,Spring Boot Actuator,我理解,通过使用致动器,我们必须使用Jackson而不是Gson: 当首选json映射器是Gson时,一些执行器端点将被破坏。复制步骤: ,依赖项:Web,执行器。生成项目 编辑pom.xml,添加gson依赖项 <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </dependency>
pom.xml
,添加gson依赖项
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
/exactor/beans
,它将遇到500个内部服务器错误,日志为:
WARN 14692 --- [nio-8080-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Attempted to serialize java.lang.Class: org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor. Forgot to register a type adapter?; nested exception is java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor. Forgot to register a type adapter?
/exactor/mapping
,它还将遇到另一个错误如何让应用程序代码使用Gson,而仍然让执行器使用Jackson?这里有关于您的问题的更新吗?我也面临同样的问题。谢谢你的回答。干杯
WARN 14692 --- [nio-8080-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Attempted to serialize java.lang.Class: org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor. Forgot to register a type adapter?; nested exception is java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor. Forgot to register a type adapter?