Forum Discussion

DavidThielen's avatar
DavidThielen
Occasional Contributor
4 years ago

How do I create a Java server framework?

Hi all;

 

Reading the details on Swagger (we first got it to create clients to our REST server), it looks like it can create the framework for a server app that implements the defined API.

 

We need to do this for Java (our existing REST server is .Net). We have prospects who want Java, not .Net Core.

 

What's the best way to do this? I see a ton of Java server choices. What I want is something that is as simple as possible to install, configure, and administer. Before Swagger I was thinking Spring, but I have not been in the server side of Java for 15 years so I likely don't know what's the latest/greatest approach for all this.

 

??? - thanks - dave

1 Reply

  • Hi Dave,

     

    if I get this right, just to recap, you have a Swagger/OpenAPI 2.x or OpenAPI 3.x definition, which currently maps to a .NET server exposing the endpoints, and you are using swagger-codegen to generate the client; you would like to implement the server in Java as well or instead, and you would like to use swagger-codegen to generate a server stub. 

     

    Your question is which java technology to use for such a server, I assume among the ones available in swagger-codegen for server stubs. 

     

    It's a bit a tricky question, and answer is not easy and opinionated, as there are many frameworks out there, each with its pros and cons, and this is not really related to swagger-codegen.

     

    The kind of main players are indeed still spring and jaxrs (with its implementations, e.g Jersey and RestEasy), again each with it's strong and weak areas.

     

    As "something that is as simple as possible to install, configure, and administer", it really depends what you need to do, out of the box both techs and implementations provide a quite dev-friendly onboarding and setup/configuration, they are both active projects, with plenty of docs and info, Spring provides a lot more than a simple REST framework in its ecosystem, therefore could be simpler some time to add features, but you would be more tightly coupled to what they provide.

     

    Possibly you could try a go with both (e.g jaxrs and spring languages for v2, jaxrs-jersey and spring for v3) and see what fits more your needs.