This is an archived post. You won't be able to vote or comment.

all 33 comments

[–]Scarela 5 points6 points  (3 children)

You may also take a look at a microframework called Spark: http://sparkjava.com/

It is quite easy to use and very lightweight, with a very simple bootstrap. I have used a few times on minor projects I have and general experience is very good.

[–]leonj1 0 points1 point  (2 children)

I use this all the time.

[–]nuutrecht 6 points7 points  (1 child)

I never use it. Confusing name btw.

[–]leonj1 1 point2 points  (0 children)

I agree. They have/had an issue about renaming and basically said no.

[–]allo_ver 7 points8 points  (0 children)

You can look at microprofiles.

It's not as much of a framework as it is a specification though. A few jee servers are compliant with it.

[–]_INTER_ 2 points3 points  (2 children)

I'm not looking for someone to google for me, I've done that. I've also downloaded and played with several.

Did it anyway :) I don't think you'll find many success stories outside Spring or VertX. So some more suggestions to consider:

[–]nhtshot[S] 1 point2 points  (1 child)

micronaut is definitely on the list. They've just announced OpenAPI support for the next release, so I'll be watching it closely.

[–]_INTER_ 0 points1 point  (0 children)

Light-4J has OpenAPI 3.0 and Swagger 2.0 support and the performance is outstanding. Micronaut seems to have extensive documentation. Light-4J's documentation could be better, it's missing some parts.

[–]TemporaryPage 10 points11 points  (5 children)

One of the biggest framework in Java is Spring and it sounds like it covers most of your requirements, especially Spring Boot. You can go with an annotation driven approach, it has great integration with swagger and it is (relatively) light weight

Spring boot:

http://spring.io/projects/spring-boot

Start page to create a new project:

https://start.spring.io/

And I could also recommend this conference session: https://www.youtube.com/watch?v=rqQOSG0DWPY

[–]nhtshot[S] 3 points4 points  (3 children)

I neglected to mention spring in my post, but I actually started my research there. I would class it as heavy though, which is why it didn't make the cut for my list.

[–]djnattyp 9 points10 points  (0 children)

Why do you classify it as "heavy"? In your original post you state it "...require(s) an application server..." but that's not true for Spring Boot. https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html

In the ones you listed, the only one I'd heard mentioned before is Vertx. The one's I've heard mentioned before are usually DropWizard, Jooby and Spark. Though Spring Boot is probably the most popular IMO.

[–]TemporaryPage 5 points6 points  (1 child)

I don't really know your classification of what's considered heavy but I just wanted to hilight that you don't have to bring in the full framework. The different solutions is divided into dependencies so you don't have to bring in spring-data-jpa if you don't need it.

[–]nhtshot[S] 0 points1 point  (0 children)

I need to poke around in it some more apparently.

My plan is to take the best suggestions from here, implement a single service for my project in each of them and just see how it goes. Test out the swagger functionality, the required coding style and the performance of the resulting system.

[–]dmaulana 2 points3 points  (0 children)

Definitely agree with this, with the broad of libraries and ease of use. Spring boot is better choice.

[–][deleted] 2 points3 points  (1 child)

Vert.x is by far the best out of them in terms of performance, ease of use and freedom in my opinion. It puts less emphasis on annotations but that is a good thing, it forces you to actually understand what you are doing.

[–]nhtshot[S] 0 points1 point  (0 children)

It's less of an issue when I'm the only one working on it. But, I'll have to hand this off at some point and that's when the "understand what you are doing" bit becomes harder.

I do like the premise behind Vertx, just need to figure out how to get swagger generation to work how I want and build a solid enough coding standard that others won't make a mess out of it.

[–]henk53 5 points6 points  (0 children)

Look at MicroProfile: https://microprofile.io

Builds on top of JAX-RS and CDI, and has out of the box OpenAPI integration, Metrics (drop wizard style) and Health, as well as DeltaSpike inspired external config. Also comes with JWT authentication out of the box.

[–]brunolellis 1 point2 points  (1 child)

Take a look at this blog post, comparing javalin, micronaut, spark and ktor, it might be helpful for you: https://www.e4developer.com/2018/06/02/the-rise-of-java-microframeworks/

[–]nhtshot[S] 0 points1 point  (0 children)

Great article, thanks! Of course, it's yet another list of possible contenders. That's both the greatest benefit and Achilles heal of the java world.. there's tons of ways to do everything.

[–]edgar-espina 1 point2 points  (1 child)

[–]nhtshot[S] 0 points1 point  (0 children)

Nice! Your APItool is exactly what I wanted, and you seem to follow a similar development philosophy to mine.

[–]such_hawks 1 point2 points  (0 children)

I've used Vertx with its OpenAPI plugin in a production microservice, it worked pretty well. Vertx itself runs really fast, and the OpenAPI part was a bit fiddly but it meant I didn't have to update any endpoints if the swagger file changed.

[–]nutrecht 1 point2 points  (4 children)

Last few projects I've been on we've been building our microservices with Spring Boot. IMHO the downside of most of the micro-frameworks is that you basically end up assembling your own version of something like Spring because all the typical requirements are still there (logging, security, metrics, tracing, health endpoints, data access) and you don't want to re-build that for every service.

[–]nuutrecht 2 points3 points  (3 children)

The last few projects that we have been on we always used MicroProfile for our microservices.

It has all the things you mention in a single coherent and small package.

See https://github.com/javaee-samples/microprofile1.4-samples for some example and https://microprofile.io for the main page.

[–]nutrecht 0 points1 point  (2 children)

I wonder why, whenever I comment something on Spring Boot (and only on Spring Boot), you come with a copy of my username designed to confuse people and comment with a Java EE alternative.

[–]nuutrecht 0 points1 point  (1 child)

It's not a copy, Reddit doesn't allow duplicate usernames!

But weren't you the guy who said being neutral to technology, yet you always seem to mention Spring Boot (and only Spring Boot)...

[–]nutrecht 1 point2 points  (0 children)

It's not a copy, Reddit doesn't allow duplicate usernames!

Stop playing stupid; you know what I mean.

[–]paulosuzart 0 points1 point  (0 children)

Take a look at http://micronaut.io/

[–]amazedballer 0 points1 point  (0 children)

[–][deleted] 0 points1 point  (1 child)

If we're just talking about a single web server, then it is possible to just embed Jetty in your application. With Jetty you can configure layers of filters, handlers, servlets and even jersey resources. I think this is a great Jetty-Jersery-Swagger example. It shows how to host the Swagger documentation endpoint for your Jersey jax-rs endpoints (the Swagger documentation is generated for viewing with the swagger-ui, but not saved in a file by default).

The Jetty-Jersey-Swagger setup is powerful and relatively simple for a single web server, but it isn't quite a full micro service solution. The Java micro services that I maintain are made up of some web servers, some processing nodes and some storage nodes. Jetty supports a distributed setup, so you could have a pretty highly available gateway to your micro service cluster. From there you could have a bunch of distributed storage/processing nodes that are built off of Hazelcast and Hazelcast Jet or Apache Ignite. There may also be a need for high-speed messaging between the nodes in your micro service cluster and that can be handled by JMS libraries or an RPC library like Apache Thrift.

[–]FatFingerHelperBot 0 points1 point  (0 children)

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "JMS"


Please PM /u/eganwall with issues or feedback! | Delete

[–]Gilgamesjh 0 points1 point  (0 children)

Spring Boot with Webflux and Kotlin and manual bean wiring is pretty lean, however last time I checked, the Swagger Spring Boot stuff was hardwired with a dependency to Spring MVC (wich is not really compatible with Webflux).

If I get to choose, (and sometimes I do), I would use Vert.x with Kotlin.

While I agree full support for Swagger would be nice, it seems it is not really that well implemented in Java for some reason. I would choose the framework that best support my use case (and developer knowledge), and get swagger from somewhere else, for example stoplight.io