GraphQL-给出错误的联合类型找不到该类型名称的类

GraphQL-给出错误的联合类型找不到该类型名称的类,graphql,graphql-schema,Graphql,Graphql Schema,在我的GraphQL模式文件中,我尝试添加一个联合类型,如下所示: type CoOverrides { coId: String type: String } type SoOverrides { soId: String freeInterval: String } union CoOrSoOverrides = CoOverrides | SoOverrides type Campaign { id: ID! title: String

在我的GraphQL模式文件中,我尝试添加一个联合类型,如下所示:

type CoOverrides {
    coId: String
    type: String
}

type SoOverrides {
    soId: String
    freeInterval: String
}

union CoOrSoOverrides = CoOverrides | SoOverrides
type Campaign {
    id: ID!
    title: String
    overrides: [CoOrSoOverrides]
}
然后我将其分配给我的类型,如下所示:

type CoOverrides {
    coId: String
    type: String
}

type SoOverrides {
    soId: String
    freeInterval: String
}

union CoOrSoOverrides = CoOverrides | SoOverrides
type Campaign {
    id: ID!
    title: String
    overrides: [CoOrSoOverrides]
}
但是,在启动graphql服务器时,我不断收到错误:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParser]: Factory method 'schemaParser' threw exception; 
nested exception is com.coxautodev.graphql.tools.SchemaClassScannerError: 
Object type 'CoOverrides' is a member of a known union, but no class could be found for that type name.  Please pass a class for type 'CoOverrides' in the parser's dictionary.
这到底是什么?如何将这个类添加到解析器的字典中

谢谢你的帮助


谢谢。

与错误消息一样-将
CoOverrides
类传递到字典

@Configuration
public class SchemaParserConfig {

    @Bean
    public SchemaParserDictionary schemaParserDictionary() {
        return new SchemaParserDictionary()
                .add(CoOverrides.class);
    }

}