How can i expose 2 endpoints on spring boot graphql

Viewed 52

I am using following library for spring boot project:

implementation 'com.graphql-java:graphql-spring-boot-starter:5.0.2'

By default it exposes one endopoint on "/graphql", but due to nature of my application i would like to expose 2 endpoints. One on "/internal" and another on "/external". How can i do that?

I found a similar question for an older version of library that wont work with the new one.

1 Answers

You can define specific url like this;

server.servlet.context-path=/graphql-custom

So, if you want to add multiple url;

<servlet-mapping>
   <servlet-name>graphql</servlet-name>
   <url-pattern>/internal</url-pattern>
</servlet-mapping>
<servlet-mapping>
   <servlet-name>graphql</servlet-name>
   <url-pattern>/external</url-pattern>
</servlet-mapping>
Related