Ask HN: What is a modern Java environment?

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Quarkus

    Quarkus: Supersonic Subatomic Java.

  • I can't speak to how prevalent it is in the industry, but something my team has started doing in our web services is building with GraalVM and deploying native images. The build time can be super long, but the benefit is incredibly fast start-up time, which really benefits horizontal scaling. We're using Quarkus (https://quarkus.io), which is largely built on Vertx which was mentioned elsewhere, but other frameworks (Micronaut (https://micronaut.io) comes to mind) make it easy and SpringBoot is also working on support. If your doing containers/kubernetes native images feel like the way to go.

  • Micronaut

    Micronaut Application Framework

  • I can't speak to how prevalent it is in the industry, but something my team has started doing in our web services is building with GraalVM and deploying native images. The build time can be super long, but the benefit is incredibly fast start-up time, which really benefits horizontal scaling. We're using Quarkus (https://quarkus.io), which is largely built on Vertx which was mentioned elsewhere, but other frameworks (Micronaut (https://micronaut.io) comes to mind) make it easy and SpringBoot is also working on support. If your doing containers/kubernetes native images feel like the way to go.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • prime-mvc

    Prime MVC is a high performance Model View Controller framework built in Java.

  • My company's product is primarily written in Java. It's a web based auth system, fwiw.

    I don't write too much code nowadays, but read a lot. From what I can see, here's the stack:

    * intellij for an ide (with tons of plugins)

    * prime MVC (https://github.com/prime-framework/prime-mvc) for the framework

    * mybatis for SQL/queries

    * java 17

    I've also used dropwizard and spring. If it was a greenfield development with emphasis on developer productivity, I'd go with spring any day. Big dev community, tons of doco, a solution for any problem if you can find it.

  • SDKMan

    The SDKMAN! Command Line Interface

  • kotlin

    The Kotlin Programming Language.

  • * Try to use Kotlin where allowed (Maybe unpopular and bad faith response given that you asked about Java, but I don't care -- kotlin's Java interop is way more seamless than Scala or Clojure to the point that its often not even noticable) https://kotlinlang.org/

  • FrameworkBenchmarks

    Source for the TechEmpower Framework Benchmarks project

  • In practice, you're most likely to see Spring Boot in existing projects since it's so boring and dependable, though perhaps sometimes you'll also run into the legacy Spring framework (which can be a pain to deal with) or even some of the other ones.

    Here's a rough performance comparison if you care about that sort of stuff: https://www.techempower.com/benchmarks/#section=data-r20&hw=...

    Build tools: personally, i just use whatever Docker images to base the apps on when available and something like Ansible when not. For the actual toolchain, Maven is still pretty dependable, i guess Gradle is also okay. You might occasionally run into tools like Bazel or Jib, experiences there might vary.

    App servers: if you need an application server for some reason (e.g. deploy app as .war), Tomcat is still a good option. If you need the EE functionality (e.g. Java EE which is not Jakarta Java), you might need to reach for something like TomEE or Payara Server, though i haven't needed to do that for a few years at this point, since Spring Boot embeds Tomcat and that is good enough for almost all projects.

  • intellij-plugins

    Open-source plugins included in the distribution of IntelliJ IDEA Ultimate and other IDEs based on the IntelliJ Platform

  • IDE: IntelliJ IDEA https://www.jetbrains.com/idea/

    Nothing else seems to come close, they have a Community version, nowadays Eclipse and NetBeans both feel slow but Visual Studio Code with Java plugins lacks refactoring abilities one might expect in an IDE for non-trivial projects.

    JDK: whatever the LTS release of JDK is at the time, based on the kind of work that i do (so JDK 17 now) https://adoptium.net/

    As long as you're not stuck with JDK 8, you should be fine in regards to this. But you can definitely enjoy some speed improvements across the releases as well as new language features as well as things like helpful NullPointerException messages. Personally, i'd sometimes also look towards OpenJ9 as an alternate runtime (due to lower memory usage), but that project's future isn't very clear (at least in regards to available container images) last i checked.

    As for frameworks, pick one of the following:

      - Spring Boot: mainstay of the Java ecosystem, has a really large amount of integrations and the Boot version also simplifies getting up and running, about as safe of a bet as Rails for Ruby or Django for Python

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • adoptium

  • IDE: IntelliJ IDEA https://www.jetbrains.com/idea/

    Nothing else seems to come close, they have a Community version, nowadays Eclipse and NetBeans both feel slow but Visual Studio Code with Java plugins lacks refactoring abilities one might expect in an IDE for non-trivial projects.

    JDK: whatever the LTS release of JDK is at the time, based on the kind of work that i do (so JDK 17 now) https://adoptium.net/

    As long as you're not stuck with JDK 8, you should be fine in regards to this. But you can definitely enjoy some speed improvements across the releases as well as new language features as well as things like helpful NullPointerException messages. Personally, i'd sometimes also look towards OpenJ9 as an alternate runtime (due to lower memory usage), but that project's future isn't very clear (at least in regards to available container images) last i checked.

    As for frameworks, pick one of the following:

      - Spring Boot: mainstay of the Java ecosystem, has a really large amount of integrations and the Boot version also simplifies getting up and running, about as safe of a bet as Rails for Ruby or Django for Python

  • Vert.x

    Vert.x is a tool-kit for building reactive applications on the JVM

  • [3] - https://vertx.io/

  • Async Http Client

    Asynchronous Http and WebSocket Client library for Java

  • reactor-core

    Non-Blocking Reactive Foundation for the JVM

  • gwizard

    A modular toolkit for building web services with Guice, inspired by DropWizard

  • I have been thinking of writing up a series of articles on this. Without going into too much detail:

    * IDEA

    * Deploy on Google App Engine, Digital Ocean App Platform, Heroku, Elastic Beanstalk, etc - get out of the ops business entirely.

    * Guice as the backbone, no Spring/Boot. I wrote a tiny dropwiard-like "framework" to make this easier: https://github.com/gwizard/gwizard but there's a laughable amount of code here, you could build it all from scratch with minimal effort. This is about as lightweight as "frameworks" get because Guice does the heavy lifting.

    * JAX-RS (Resteasy) for the web API. IMO this is the best part of Java web development. HTTP endpoints are simple synchronous Java methods (with a few annotations) and you can test them like simple Java methods.

    * Lombok. Use @Value heavily. Cuts most of the boilerplate out of Java.

    * Junit5 + AssertJ. (Or Google Truth, which is almost identical to AssertJ).

    * Use functional patterns. Try to make all variables and fields final. Use collections streams heavily. Consider vavr.io (I'll admit I haven't it in anger yet, but I would in a new codebase).

    * StreamEx. Adds a ton of useful stream behavior; I don't even use basic streams anymore.

    * Guava. There's just a lot of useful stuff here.

    * For the database, it really depends on what you're building. Most generic business apps, postgres/hibernate/guice-persist/flyway. Yeah, folks complain about hibernate a lot but it's a decent way to map to objects. Use SQL/native queries, don't bother with JPQL, criteria queries, etc.

    * Hattery for making http requests (https://github.com/stickfigure/hattery). This is another one of mine. I make zillions of http requests, functional/immutable ergonomics really matter to me.

    * Github actions for CI.

    * Maven for the build. Yes, it's terrible, except for every other build system is worse. Gradle seems like it should be better but isn't. I'd really love some innovation here. Sigh.

  • hattery

    Java library for making HTTP requests with a fluent, immutable API

  • I have been thinking of writing up a series of articles on this. Without going into too much detail:

    * IDEA

    * Deploy on Google App Engine, Digital Ocean App Platform, Heroku, Elastic Beanstalk, etc - get out of the ops business entirely.

    * Guice as the backbone, no Spring/Boot. I wrote a tiny dropwiard-like "framework" to make this easier: https://github.com/gwizard/gwizard but there's a laughable amount of code here, you could build it all from scratch with minimal effort. This is about as lightweight as "frameworks" get because Guice does the heavy lifting.

    * JAX-RS (Resteasy) for the web API. IMO this is the best part of Java web development. HTTP endpoints are simple synchronous Java methods (with a few annotations) and you can test them like simple Java methods.

    * Lombok. Use @Value heavily. Cuts most of the boilerplate out of Java.

    * Junit5 + AssertJ. (Or Google Truth, which is almost identical to AssertJ).

    * Use functional patterns. Try to make all variables and fields final. Use collections streams heavily. Consider vavr.io (I'll admit I haven't it in anger yet, but I would in a new codebase).

    * StreamEx. Adds a ton of useful stream behavior; I don't even use basic streams anymore.

    * Guava. There's just a lot of useful stuff here.

    * For the database, it really depends on what you're building. Most generic business apps, postgres/hibernate/guice-persist/flyway. Yeah, folks complain about hibernate a lot but it's a decent way to map to objects. Use SQL/native queries, don't bother with JPQL, criteria queries, etc.

    * Hattery for making http requests (https://github.com/stickfigure/hattery). This is another one of mine. I make zillions of http requests, functional/immutable ergonomics really matter to me.

    * Github actions for CI.

    * Maven for the build. Yes, it's terrible, except for every other build system is worse. Gradle seems like it should be better but isn't. I'd really love some innovation here. Sigh.

  • kotlinx-kover

  • - Language: Java 17 or Kotlin

    - API Layer: For tiny projects, Vert.x API directly, for larger projects Quarkus

    - DB: Postgres, in-memory H2 for simple stuff

    - Testing: JUnit 5, Testcontainers to automatically start + stop DB Docker containers with tests, Mockito or Mockk (Kotlin) for mocks

    - Dependency Injection: CDI (built into Quarkus, for Vert.x you can initalize Weld when the app starts)

    - Build tool: Gradle with Kotlin DSL

    - Other tools:

      Kover: automatic code-coverage reports from JaCoCo/IntelliJ (https://github.com/Kotlin/kotlinx-kover)

  • NullAway

    A tool to help eliminate NullPointerExceptions (NPEs) in your Java code with low build-time overhead

  • PMD, Spotbugs, Nullaway: Java linting/static analysis (https://pmd.github.io, https://spotbugs.github.io, https://github.com/uber/NullAway)

  • Spotbugs

    SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.

  • PMD, Spotbugs, Nullaway: Java linting/static analysis (https://pmd.github.io, https://spotbugs.github.io, https://github.com/uber/NullAway)

  • PMD

    An extensible multilanguage static code analyzer.

  • PMD, Spotbugs, Nullaway: Java linting/static analysis (https://pmd.github.io, https://spotbugs.github.io, https://github.com/uber/NullAway)

  • ktlint

    An anti-bikeshedding Kotlin linter with built-in formatter

  • Ktlint + Detekt: Kotlin linting/static analysis (https://ktlint.github.io, https://detekt.github.io/detekt)

  • JHipster

    JHipster, much like Spring initializr, is a generator to create a boilerplate backend application, but also with an integrated front end implementation in React, Vue or Angular. In their own words, it "Is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures."

  • orm16

    Code generation-based approach to ORM for Java 17, focusing on records as persistent data model

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts