Compatibility issue with spring boot and apollo federation

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?

Hello :wave:

Don’t use the graphql-java-kickstart packages as those community packages were officially deprecated in favor of official Spring packages.

As for adding Federation support to your Spring GraphQL services, instead of manually transforming the schema use the Spring provided transformers → see official docs for details

@Bean
public GraphQlSourceBuilderCustomizer customizer(FederationSchemaFactory factory) {
	return builder -> builder.schemaFactory(factory::createGraphQLSchema);
}

@Bean
public FederationSchemaFactory schemaFactory() {
	return new FederationSchemaFactory();
}

Thank you. Will adapt the same you, mentioned.