
Java REST framework Dropwizard 1.0 released - donselaar
http://www.dropwizard.io/1.0.0/docs/about/release-notes.html
======
niftich
Dropwizard is really just an opinionated bundling of sane Java libraries that
don't suck, and is essentially tailor-made for the (quasi-)event-driven
processing model of:

1\. request comes in

2\. do stuff here

3\. response goes out

While this may not sound very exciting, this is exactly what goes on in HTTP
APIs. People these days use Node or Go for this kind of stuff, but Dropwizard
makes it very pleasant to do it in Java.

~~~
alexbanks
My greatest gripe with Java was the amount of crap one had to go through just
to build a simple Rest API. When I saw DropWizard I thought it solved that
need. Maybe it's time to get back into Java development...

~~~
cle
If you love dealing with magic "comefrom" annotations, codegen that isn't
debuggable, and foundational libraries that have to resort to bytecode manip
to get stuff done, then go ahead.

~~~
alexbanks
So, is the answer to just bail on Java forever? I haven't written anything
legitimate in Java in about two years, but I don't remember it being that bad.

For reference, what types of languages/frameworks do you like to work with?

~~~
darylteo
If you want to venture back to the JVM, Kotlin offers a very good middle
ground between Java and Scala.

~~~
premium-concern
What's the "middle ground"? Java with a more concise syntax?

~~~
darylteo
Pretty much. Its been very enjoyable to code in so far (and works with
practically the whole Java ecosystem of libraries and platforms.

IntelliJ (Jetbrains are the leaders behind Kotlin) has first class support for
the language. Gradle will have support for Kotlin as it's DSL in it's next
major iteration.

~~~
premium-concern
Well, if you think the most important technical improvement to language design
discovered since the creation of Java in 1995 is some shorter syntax, go
ahead. I guess.

Despite some very loud people on the internet, it seems to have close to zero
adoption, and JetBrains making big promises and then failing to deliver
anything is not really helping them.

------
spapas82
Dropwizard is great for REST APIs (... as the title says). However if you want
to use traditional views (MVC, html templates, security, forms etc) then
please check something else (I tried it and lost many hours -- in the end I
still couldn't do even basic things).

For traditional web development, I recommend spring-boot which is almost as
easy as dropwizard, it also doesn't need an application container _and_ fully
supports Spring MVC, Spring Security and all other spring related goodies.

~~~
jsight
What templating language did you use with Spring MVC?

~~~
manyxcxi
I've been using Thymeleaf with Spring for a while and almost always
exclusively use it with Spring Boot because it's pretty much right out of the
box ready to go.

I stumbled on it a long time ago because I had the problem of Java devs
needing to integrate templates built by front end devs and all the churn that
goes along with it.

It uses custom tag attributes like th:href to swap the computed value in on
template render so you can have a completely perfect looking HTML/CSS/JS
template with the placeholder values without having to convert back and forth.
It's just HTML with extra attributes that get ignored when not run through the
rendering process.

You can use Spring Expressions, forms, and security with pretty much no
configuration, it works awesome.

It supports partials and layouts and all the good stuff you'd want for reuse
and it took me about 10 minutes to create a custom dialect for it that lets me
use Thymeleaf and Vue.js together very nicely.

I can't recommend Thymeleaf enough.

~~~
kentosi
One issue is if you're using Angular. Your html document needs to be xhtml
compatible, meaning that an expression like this:

    
    
      <div ng-if="this() && that()" ...
    

Needs to become:

    
    
      <div ng-if="this() &amp;&amp; that()" ...
    

If this doesn't bother you (along with &gt; for <, etc) then go ahead.

~~~
manyxcxi
It doesn't have to if you write your own dialect for Thymeleaf. You can alter
the flow of the output manipulation and validation- it's out of the box that
it chokes on the 'weird' stuff being shoved into attribute tags nowadays for
JS templates.

If you want the unescaped output there are lots of things you can do. I did
something similar for Vue.js in about twenty minutes and a few lines of code.

------
necubi
Nice to see a 1.0 release. We've been using Dropwizard for various public and
internal APIs for a couple of years and have been very happy with it. The
components (jersey, jackson, coda hale metrics) are all very pleasant to work
with, and generally have low-ceremony APIs that feel as productive as the ruby
or python equivalents while providing the performance and operability of the
JVM.

It's not the fastest or most scalable option on the JVM (that would probably
be something netty based) and the API is an awkward fit for anything streaming
or asynchronous, but it's the best thing I've found for its niche.

~~~
abalone
What JVM microframeworks would you recommend for streaming or async?

~~~
campers
You can plug Quasar/Comsat in to get lightweight threads
[http://blog.paralleluniverse.co/2014/01/22/introducing-
comsa...](http://blog.paralleluniverse.co/2014/01/22/introducing-comsat/)

RatPack is a nice async microframework

~~~
abalone
One thing I find odd about ratpack is that it still hasn't submitted itself to
the Techempower benchmarks.[1]

[1]
[https://github.com/ratpack/ratpack/issues/902](https://github.com/ratpack/ratpack/issues/902)

------
allengeorge
I've had an excellent experience with Dropwizard. It combines robust, simple-
to-use libraries, has excellent documentation, is easy to poke into, and "just
works". It's my go-to framework if I want to create REST apps in Java.

Congrats on the 1.0 release!

~~~
ianai
So you've never had to do byte code manipulation or other weird things like
another commentor said?

~~~
andrewaylett
Appropriate magic.

Jackson uses byte-code manipulation to get its work done, but you'll never see
it nor have to interact with it -- all you see is a nicely annotated class
that automatically converts to and from JSON as it enters and leaves your
code. For advanced use-cases you may have to ask for the ObjectMapper and
convert strings yourself, but you'll never need to know how it's implemented.

To my mind, appropriate magic is where you define your interface to have a
simple-to-use but complete API, hiding the complexity of implementation. For
example, Guava's CacheMap implementation has careful internal locking to
present a consistent but high-performance thread-safe object, rather than
requiring external locking or needing the caller to avoid certain combinations
of actions, both of which I've seen when I've come across people who tried to
implement their own. Or, in Jackson's case, high-performance data manipulation
that could be done using reflection but isn't because that would be too slow.

------
616c
Love them or hate them (I am in the latter category), but observe even Uber
mentions some of their heavier backend stack for internal usage runs on
Dropwizard.

"The highest-volume service in this area is Gurafu, which provides a set of
utilities for working with road map data and improves efficiency and accuracy
by providing more sophisticated routing options. Gurafu is fronted by µETA,
which adds a business logic layer on top of raw ETAs (things like experiment
group segmentation). Both Gurafu and µETA are web services built on the
DropWizard framework."

[https://eng.uber.com/tech-stack-part-one/](https://eng.uber.com/tech-stack-
part-one/)

[https://news.ycombinator.com/item?id=12152346](https://news.ycombinator.com/item?id=12152346)

------
dozzie
Funny that everybody rush for REST framework, while most of the time people
cramming REST in their applications need less "read, upload, replace, delete"
operation model and more "normal functions, except called remotely" provided
by RPC.

But RPC-over-HTTP (XML-RPC, JSON-RPC, or even Thrift) is a problem solved long
ago, so it's not sexy enough, I think.

~~~
teen
Couldn't agree more. REST is just a very leaky abstraction layer, when what
you really want is RPC, with some reusable / composable typed models.

~~~
dustingetz
I don't know, RPC is declaring for no abstraction at all, just raw access to
code that can do anything. REST provides strong abstractions, they are just
slow, and to make the app fast we have to compromise them. But that's the same
for relational databases and ORM; I think really REST isn't the problem, but
instead SQL. And RPC is like writing bits with butterflies.

~~~
dozzie
Erm... Abstractions? In REST? What abstractions?

------
axelfontaine
Congratulations to the Dropwizard team!

We have had great results internally here at Boxfuse with Dropwizard. So good
in fact that we decided to add Dropwizard-specific optimizations to our
deployment tool for running Dropwizard apps on AWS with a single command.

[https://boxfuse.com/getstarted/dropwizard](https://boxfuse.com/getstarted/dropwizard)

------
paukiatwee
I learnt to use DW by building an open source personal budgeting app[0]. DW
really good and awesome. No whatsoever bytecode manipulation problem.

Everything work great. If you learn real work DW app, see my open source
project.

Stack:

1\. AngularJS 1.x as frontend

2\. DW as REST backend

3\. Hibernate as Data Access Layer

4\. PostgreSQL as DB

[0]:
[https://github.com/paukiatwee/budgetapp](https://github.com/paukiatwee/budgetapp)

------
cs02rm0
Hurray.

Now maybe those PHBs who think we should use spring-boot because it's passed
1.0 will pipe down. Or not. Anyway, good to see - especially with HTTP2.

------
CraigJPerry
After flywaydb, liquibase feels like a step backward not forward.

------
pcsanwald
I've used Dropwizard for many years, and have always been a big fan. It made
java development fun again for me. Congrats to the team for an awesome new
release, and also for doing a great job over the years of balancing features
and upgradeability.

------
abalone
Does anyone know why dropwizard ranks so low and slow in the techempower
benchmarks? For such an apparently thin microframework I always wondered what
the culprit is and whether it could be optimized.

See
[https://www.techempower.com/benchmarks/#section=data-r12&hw=...](https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=json&l=3k)

~~~
einrealist
Jax RS has more overhead compared to the Servlet API. Using the Servlet API,
Jersey (Jax RS implementation) must route the request to the correct resource
class (Controller). Dependencies of that class as well as lifecycle
dependencies (filters, interceptors, message body readers and writers) have to
be instantiated to finalise the request.

------
orsenthil
Congratulations on 1.0 release. I love dropwizard too, it makes backend
development seem very sane and predictable.

To teams that you Dropwizard, what is your front end stack? Do you use Angular
and communicate with proxy to dropwizard or do you do something which talks to
Dropwizard API directly?

~~~
alxeder
During initial development we are starting out with bundeling our angular app
with the api by serving the angular app as dropwizard assets. There we use
webpack-dev-server in proxy mode for easier development with livereload. We
don't like the complexity of seperation from the start. If we run into
problems (assets need to scale differently than the api) it's pretty easy to
extract the static angular app and serve it via a separate webserver.

------
sgt
Also consider [http://vertx.io/](http://vertx.io/) \- very interesting,
especially for the Java EE guys looking for something less stateful.

------
JoshGlazebrook
Ah Dropwizard. Even though Java isn't my favorite, it really wasn't that bad
to work with when making a tic-tac-toe game for a coding assignment for a job
interview.

------
mbasim
Congratulations!!!!

