在使用graphql和Spring时,我试图运行该项目,但我遇到了以下情况:
exception:org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'graphQLSchema' defined in class path resource
[io/leangen/graphql/spqr/spring/autoconfigure/SpqrAutoConfiguration.class]:
Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate
[graphql.schema.GraphQLSchema]: Factory method 'graphQLSchema' threw exception;
nested exception is io.leangen.graphql.metadata.exceptions.TypeMappingException:
Multiple methods detected for operation "defaultInstanceForType" with different
return types. Types found: [com.google.protobuf.Message, com.google.protobuf.MessageLite].
If this is intentional, and you wish GraphQL SPQR to infer the most common super type automatically, see
https://github.com/leangen/graphql-spqr/wiki/Errors#operation-with-multiple-resolver-methods-of-different-types 我被重定向到这里寻求帮助:https://github.com/leangen/graphql-spqr/wiki/Errors#operation-with-multiple-resolver-methods-of-different-types
我没有多个名称相同的方法来触发我,异常中的URL没有帮助,甚至不能被编辑或注释。
发布于 2020-07-09 13:41:31
删除protobuf时间戳字段解决了问题!
在更改了返回对象之后,我不得不重构com.google.protobuf.Timestamp,LocalDate,甚至字符串,并且它工作得很好。
https://stackoverflow.com/questions/62816261
复制相似问题