Our great sponsors
-
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.
-
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.
-
Mergify
Updating dependencies is time-consuming.. Solutions like Dependabot or Renovate update but don't merge dependencies. You need to do it manually while it could be fully automated! Add a Merge Queue to your workflow and stop caring about PR management & merging. Try Mergify for free.
-
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.
-
-
* 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/
-
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
-
Sonar
Write Clean Java Code. Always.. Sonar helps you commit clean code every time. With over 600 unique rules to find Java bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.
-
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
-
[3] - https://vertx.io/
-
-
-
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.
-
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.
-
- 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)
-
PMD, Spotbugs, Nullaway: Java linting/static analysis (https://pmd.github.io, https://spotbugs.github.io, https://github.com/uber/NullAway)
-
PMD, Spotbugs, Nullaway: Java linting/static analysis (https://pmd.github.io, https://spotbugs.github.io, https://github.com/uber/NullAway)
-
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
-
InfluxDB
Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.