Closed hfye closed 6 years ago
Hi,
i just tried to change the context path (but without deploying as WAR).
In the application.properties
file I changed server.context-path
to /petclinic
and then again run mvnw spring-boot:run
.
Calling the GraphQL API then just works, as in this call using curl:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"query": "{ pets { name } }"}' \
http://localhost:9977/petclinic/graphql
The GraphQL Browser (GraphiQL) does not work. If I remember correctly there was a problem when the app runs unter another context path since there was no way to change the URL the GraphiQL uses for it's calls to the backend.
Do you have problems with the API or with GraphiQL?
Hi nilshartmann,
I don't have any problem to run mvnw spring-boot:run with context path /petclinic. GraphiQL by default points to the context path /graphql. So it doesn't work with new context path.
My problem is with the WAR file deployment. It seems that the SpringBootApplication is not initialized after deploying war file to external TOMCAT container.
Hi, I resolved the issue. just update PetClinicApplication’s main class to extend SpringBootServletInitializer which allows servlet container to launch the application.
Hi, the same application when I extended SpringBootServletInitializer and deployed on Tomcat but GraphiQL page is loaded but return section 404 - Not Found HTML message and schema is not loaded. My object is to deploy Spring Boot with GraphQL feature on Tomcat container and also in short want to know whether it is possible to do so?
I was able to run the backend using Maven: mvnw spring-boot:run. Now I have this requirement to deploy it to Apache TOMCAT server with context path /petclinic.
When I test the connection to graphql using url /petclinic/graphql, it just returns 404 error. I have changed the settings in application.properties as: graphql.servlet.mapping=/petclinic/graphql
Do I miss out any configuration?