9 ms·
Java REST framework Dropwizard 1.0 released
- 616c 10y agoLove 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
- necubi 10y agoNice 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 10y agoWhat JVM microframeworks would you recommend for streaming or async?
- wmfiv 10y agoAkka HTTP is very nice.
- wstrange 10y agoWhat about gRPC?
- rbolkey 10y agoTake a good look at Ratpack. I've been very impressed. Built on Netty.
- campers 10y agoYou can plug Quasar/Comsat in to get lightweight threads http://blog.paralleluniverse.co/2014/01/22/introducing-comsat/ http://blog.paralleluniverse.co/2014/01/22/introducing-comsa... RatPack is a nice async microframework
- abalone 10y agoOne 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
- kubek2k 10y agothere is also vert.x worth to look at
- mbasim 10y agoCongratulations!!!!
- dozzie 10y agoFunny 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.
- crypto5 10y agoSuch frameworks mostly target communication with rich html frontend, where adaptation of rpc is very low.
- nu2ycombinator 10y agoREST is like set of best practices to design API end points like define resource as end point and map standard HTTP methods to certain operations. This makes it easy and leads to a standard in API designing. And underlying technology can be RPC or servlets too. For example define end point "/user" and client knows how to create update or delete user where as before Rest these used to be different end points for each of these operations or have to specify the kind of operation
- dozzie 10y agoMore like set of worst practices. You have some API exposed in plenty of endpoints instead of one, and on top of that you embed one of the call arguments in the URL itself. And no, it doesn't make designing API easier if you preallocate "read", "create", and "delete" operations to separate HTTP methods, and then put all the other operations in POST. "Create" and "delete" in many cases don't even make any sense to guarantee their being specially distinguished. And you say that RPC can be used under REST. Do you have any example of a REST client library that actually can do that? It's the first time I ever hear about this way. Almost everybody else uses REST like an underspecified RPC protocol, cramming call request into an ad-hoc JSON structure to HTTP POST and mixing error reporting from transport layer and from application.
- stupidcar 10y ago
- allengeorge 10y agoI'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 10y agoSo you've never had to do byte code manipulation or other weird things like another commentor said?
- andrewaylett 10y agoAppropriate 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.
- foxylion 10y agoThat's really not necessary. I don't know where this comes from, but we maintain a big Java application and never messed with the byte code. Dropwizard itself is a very mature framework an extremly easy to get started with.
- allengeorge 10y agoByte-code manipulation?! No - never. I'm not sure where that comes from. I've had to write my custom ObjectMappers for JSON and some glue mappers for JDBI - but they were pretty lightweight. In fact, I've some examples in github of a custom key-value server written using Dropwizard with examples of those...
- spapas82 10y agoDropwizard 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 10y agoWhat templating language did you use with Spring MVC?
- spapas82 10y agothymeleaf (http://www.thymeleaf.org/ http://www.thymeleaf.org/) - it is supported directly by spring boot (spring-boot-starter-thymeleaf dependecy). Also, using thymeleaf-extras-springsecurity4 you can integrate spring security tags with thymeleaf so that you can conditionally render things depending on the current user/authority into your templates!
- Deinumite 10y agoI've been looking at http://www.mitchellbosecke.com/pebble/home http://www.mitchellbosecke.com/pebble/home but I have not yet had a chance to use it.
- spapas82 10y agoHmmm seems nice and has a djangonic syntax! However I'm not really sure how easy would be to integrate with spring boot (and spring security)...
- Deinumite 10y agoI'm not sure about Spring Security but as for Spring Boot itself http://www.mitchellbosecke.com/pebble/documentation/guide/spring-integration http://www.mitchellbosecke.com/pebble/documentation/guide/sp...
- JoshGlazebrook 10y agoAh 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.
- niftich 10y agoDropwizard 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 10y agoMy 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 10y agoIf 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.
- asdf1234 10y agoYes. Most of the unnecessary complexity has just been moved from bad APIs with XML configuration to bad APIs with runtime scoped annotations, code generation and byte code manipulation. It's still a huge mess.
- axelfontaine 10y agoCongratulations 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
- cs02rm0 10y agoHurray. 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 10y agoAfter flywaydb, liquibase feels like a step backward not forward.
- pcsanwald 10y agoI'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.
- paukiatwee 10y agoI 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
- abalone 10y agoDoes 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=peak&test=json&l=3k https://www.techempower.com/benchmarks/#section=data-r12&hw=...
- einrealist 10y agoJax 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 10y agoCongratulations 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 10y agoDuring 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 10y agoAlso consider http://vertx.io/ http://vertx.io/ - very interesting, especially for the Java EE guys looking for something less stateful.