I am trying to make an spring boot graphql project compatible for apollo federation using
@QueryMapping(name = “_service”)
public _Service getService() {
GraphQLSchema graphQLSchema = buildFederatedSchema(SCHEMA_DEFINITION);
return new _Service(graphQLSchema);
}
private GraphQLSchema buildFederatedSchema(String schemaDefinition) {
// Parse SDL into GraphQL schema
GraphQLSchema schema = GraphQLSchema.newSchema()
.query(GraphQLObjectType.newObject()
.name("Query")
.build())
// Further customization of the schema as per your requirements
.build();
return schema;
}
The used packages are -
com.graphql-java-kickstart graphql-spring-boot-starter 14.0.0 com.apollographql.federation federation-graphql-java-support 5.3.0 <dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>19.2</version> <!-- Adjust version as necessary -->
</dependency>
<!-- Spring Boot Starter for GraphQL -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-graphql</artifactId>
</dependency>
Semmes there is no package versioning issue but getting
“constructor _Service in class _Service cannot be applied to given types;
required: no arguments
found: GraphQLSchema
reason: actual and formal argument lists differ in length”
for return new _Service(graphQLSchema);
Would you advise me what could be the probable reason?