anandaili
anandaili

Reputation: 15

How do I configure GraphQL servlet endpoint for graphql-java-servlet along with Micronaut Controllers?

I have got a requirement to implement a File Upload functionality using GraphQL. My current Micronaut project has already some Controller classes and graphql-java-servlet supports file upload, it needs a Servlet to be created. How do I configure the micronaut project for both Controllers and Servlet?

I have tried creating simple servlet from graphql-java-servlet in the micronaut project and keeping all my controllers as it is.

public class HelloServlet extends GraphQLHttpServlet {

  @Override
  protected GraphQLConfiguration getConfiguration() {
    ...
  }

  private GraphQLSchema createSchema() {
    ...
  }

}```

When I start the Micronaut application. it only identifies controllers and I am able to invoke them using curl request. Unfortunately (@WebServlet) is not configured and not exposed.

Upvotes: 0

Views: 442

Answers (1)

James Kleeh
James Kleeh

Reputation: 12238

Micronaut does not support the servlet API, so it is not possible to register a servlet.

Upvotes: 1

Related Questions