# Unable to use type declared in different sub graphs

**URL:** <https://community.apollographql.com/t/unable-to-use-type-declared-in-different-sub-graphs/6689>\
**Category:** Schema Design\
**Tags:** federation\
**Created:** [September 5, 2023, 5:42am UTC](https://community.apollographql.com/t/unable-to-use-type-declared-in-different-sub-graphs/6689 "2023-09-05T05:42:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jayasimha](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jayasimha](https://community.apollographql.com/u/Jayasimha)\
**Post date:** [September 5, 2023, 5:42am UTC](https://community.apollographql.com/t/unable-to-use-type-declared-in-different-sub-graphs/6689/1 "2023-09-05T05:42:34Z")

</div>

Hi,  
We are working on GraphQL POC, where we want to use the type declared in another subgraph. But we are unable to achieve it. Below is the scenario

**Tech Stack:** Java-17, Spring GraphQL

 ![Image](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/5/58cae3817498989d5f0a4440887af10e860678b0.jpeg)

In the above example we are trying to use the Asset type from SubGraph-1 in SubGraph-2, We tried to hit query from Apollo Studio. But we are getting the Asset response as null.

Could you please help here, how we can configure resolvers in Java - Spring GraphQL.

---

<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:** [September 5, 2023, 3:24pm UTC](https://community.apollographql.com/t/unable-to-use-type-declared-in-different-sub-graphs/6689/2 "2023-09-05T15:24:55Z")

</div>

Hello 👋  
I’m assuming you are running your queries through gateway/router. Without source code cannot say for certain, but it looks like you did not implement `EmployeeInformation.assets` resolver, i.e. subgraph 2 should return you a list of asset IDs. Router will then federate the call to subgraph 1 to get remaining data based on those IDs.

See [GitHub - apollographql/federation-jvm-spring-example: Apollo Federation JVM example implementation using Spring for GraphQL](https://github.com/apollographql/federation-jvm-spring-example) for example integration.

Thanks,  
Derek

---

<div class="post-metadata">

**Author:** ![Jayasimha](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jayasimha](https://community.apollographql.com/u/Jayasimha)\
**Post date:** [September 11, 2023, 5:13am UTC](https://community.apollographql.com/t/unable-to-use-type-declared-in-different-sub-graphs/6689/3 "2023-09-11T05:13:47Z")

</div>

Thanks for sharing reference @dkuc. Its working fine now

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:48pm UTC](https://community.apollographql.com/t/unable-to-use-type-declared-in-different-sub-graphs/6689/4 "2025-02-06T20:48:24Z")

</div>


