# Federation-graphql-java-support for GraphQL-SPQR

**URL:** <https://community.apollographql.com/t/federation-graphql-java-support-for-graphql-spqr/7530>\
**Category:** Schema Design\
**Tags:** federation\
**Created:** [May 17, 2024, 1:45pm UTC](https://community.apollographql.com/t/federation-graphql-java-support-for-graphql-spqr/7530 "2024-05-17T13:45:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmadhipatla](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/vmadhipatla/32/5115_2.png) [@vmadhipatla](https://community.apollographql.com/u/vmadhipatla)\
**Post date:** [May 17, 2024, 1:45pm UTC](https://community.apollographql.com/t/federation-graphql-java-support-for-graphql-spqr/7530/1 "2024-05-17T13:45:21Z")

</div>

Hi,

We use code first approach using GraphQL-SPQR in Spring. With SPQR, schema is generated during query time.  
When I tried to integrate federation-jvm, I got this error.

Caused by: org.springframework.graphql.execution.MissingSchemaException: No GraphQL schema definition was configured.  
at java.base/java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]  
at org.springframework.graphql.execution.DefaultSchemaResourceGraphQlSourceBuilder.initGraphQlSchema(DefaultSchemaResourceGraphQlSourceBuilder.java:141)

Any plans to support this?

---

<div class="post-metadata">

**Author:** ![dkuc](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dkuc/32/2892_2.png) [@dkuc](https://community.apollographql.com/u/dkuc)\
**Post date:** [May 17, 2024, 8:10pm UTC](https://community.apollographql.com/t/federation-graphql-java-support-for-graphql-spqr/7530/2 "2024-05-17T20:10:50Z")

</div>

Hello 👋  
Without having some github repository that reproduces the error it is hard to guess what might be the underlying issue. I’m not familiar with `graphql-spqr` so unsure how well it integrates with the federation. It definitely should be possible but I don’t know how easy/hard it is.

In general we ask library maintainers to provide a sample integration that can be used to run our [compatibility tests](https://github.com/apollographql/apollo-federation-subgraph-compatibility) and the results are published on our website → [Federation-compatible subgraph implementations](https://www.apollographql.com/docs/federation/building-supergraphs/supported-subgraphs#java--kotlin).

Thanks,  
Derek

---

<div class="post-metadata">

**Author:** ![vmadhipatla](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/vmadhipatla/32/5115_2.png) [@vmadhipatla](https://community.apollographql.com/u/vmadhipatla)\
**Post date:** [May 22, 2024, 2:10am UTC](https://community.apollographql.com/t/federation-graphql-java-support-for-graphql-spqr/7530/3 "2024-05-22T02:10:18Z")

</div>

Thanks Derek. I was able to figure out.

I had to do like below in my spring application to change the generated schema using Federation transform.

````auto
	@Bean
	public ExecutableSchema graphQLExecutableSchema(GraphQLSchemaGenerator schemaGenerator) {
		ExecutableSchema schema = schemaGenerator.generateExecutable();
		GraphQLSchema fedSchema = Federation.transform(schema.getSchema()).build();
		String printedSchema = new SchemaPrinter(
				// Tweak the options accordingly
				SchemaPrinter.Options.defaultOptions().
						includeDirectives(true)
		).print(fedSchema);
		System.out.println(printedSchema);

		return new ExecutableSchema(fedSchema, schema.getTypeRegistry(), schema.getBatchLoaders(), null);
	}```
````
