W-JAX Munich 2021: "Pick Technologies & Tools Faster with JHipster"
Logistics
Conference
W-JAX Munich was a hybrid conference for Java, architecture, and software innovation, taking place November 8-12, 2021. Most talks were in German.
My talk was on Tuesday, November 9, 2021, from 15:30-16:30.
Talk
I gave a session at W-JAX Munich: “Pick Technologies & Tools Faster with JHipster” (“Technologien und Tools mit JHipster schneller auswählen” in German). I discussed why we Java developers need to pick more tools more often, the challenges that come with that, and how generating code with JHipster helped pick technologies & tools faster.
I had put my second JHipster application into production in May 2021. I gave earlier versions of this talk to the London Java Community and the CinJUG (no video).
Abstract
Technologies like cloud, microservices, containers, DevOps, and apps drive Java projects today. And they also evolve at a rapid pace. That’s why we Java developers pick more technologies more often than ever before. So how can we pick the right ones? And how can we stay up-to-date?
I discussed typical challenges when picking technologies & tools. Then I introduced JHipster, an open-source application generator with 170k monthly downloads. With JHipster, we can generate the same application with different technologies. Examples are monolith vs microservice, NoSQL vs SQL back-end, Spring Boot vs Micronaut vs NodeJS vs dot.NET, or React vs Angular vs Vue front-end. We can build, test, debug, deploy and run these applications in our environment with our data. So we learn technologies & tools by running code! That’s much better than learning from outdated articles with toy examples that don’t apply to our environment and our data!
I also showed live how to generate an application with JHipster.
Historical note (as of November 2021): During the talk, attendees could vote and give feedback live via Mentimeter.
Slides
The slides were available as a PDF (4.6 MB); the PDF version is available for download here.
The slides were also available in their original Keynote format (5.3 MB) — with less text, but animated and with a look behind the curtain of individual effects; that version isn’t available for download here.
Video
No video of this talk is known.
Historical note (as of November 2021): At the time, I was looking for a new project starting in October 2022.
Additional Talk Information
More Technologies & More Often
- Java & TypeScript slide: The Java releases are from Wikipedia, as are the TypeScript releases. As of June 15, 2021, the TypeScript 4.3 release was missing there.
- Frameworks slide: The two blue dots on the left and right represent Java EE and Spring Boot. The five red dots on the right represent MicroProfile, Quarkus, Micronaut, DropWizard, and Helidon.
- Java Distributions slide: The two blue dots on the left and right represent Oracle’s JDK and IBM’s OpenJ9 (changed name from “J9” when it became an Eclipse project in 2017). The first red dot on the right represents AdoptOpenJDK, which was becoming an Eclipse project called “Adoptium” and distributes both OpenJ9 and “regular” OpenJDK releases. The other red dots represent OpenJDK distributions from Oracle, Microsoft, Amazon, RedHat, Azul, Alibaba, Bell Soft, and SAP.
What Is JHipster?
- JHipster slide: The JHipster home page is jhipster.tech. All of its projects are on GitHub.
- Safe? slide: The download numbers refer to the
generator-jhipsterNPM package. npmtrends.com showed the weekly download trend:
- JHipster Domain Language (JDL) slide:
- JDL has its own section on the JHipster site. You’ll find the various sections both on the left in the menu and on the right as a numbered list:
- For the live coding, I put both the application configuration and the data model into one JDL file. You shouldn’t: this way, your entire application is rebuilt when you update the data model part and import it again with JHipster! Instead, you should put the application and the data model into separate JDL files.
- My JDL file was the same one I used for my JHipster tutorial. It’s on GitHub and looked like this on November 9, 2021:
- The
applicationsection describes how my application was configured. No surprises here! It’s a Spring Boot monolith with H2 as the development database and PostgreSQL as the production database. It supports multiple languages — English, German, Russian. deploymentdocuments how I deployed with a Docker Compose file here.- I declared various domain objects (
entity) and theirrelationships. - In Spring Boot, I generated both service interfaces and implementation classes (
service) and Data Transfer Objects (dto).
- The
application {
config {
baseName my_simple_shop
applicationType monolith
authenticationType jwt
buildTool maven
cacheProvider ehcache
clientFramework react
clientPackageManager npm
clientTheme litera
clientThemeVariant primary
databaseType sql
devDatabaseType h2Disk
dtoSuffix DTO
enableHibernateCache true
enableTranslation true
jhiPrefix bpf
languages [en, de, ru]
messageBroker false
nativeLanguage en
packageName com.betterprojectsfaster.tutorial.jhipsterdocker
prodDatabaseType postgresql
reactive false
searchEngine false
serverPort 8080
skipClient false
skipServer false
skipUserManagement false
websocket spring-websocket
testFrameworks [cypress]
}
entities *
}
deployment {
deploymentType docker-compose
dockerRepositoryName "joedata"
}
entity Product {
name String required unique minlength(2) maxlength(90)
price Float required min(0)
description TextBlob required
picture ImageBlob required
specification Blob
category ProductCategory
inventory Integer required min(0)
}
enum ProductCategory {
Laptop, Desktop, Phone, Tablet, Accessory
}
entity Address {
addressLine1 String required minlength(2) maxlength(80)
addressLine2 String minlength(2) maxlength(80)
city String minlength(2) maxlength(80)
postalCode String minlength(5) maxlength(5)
}
entity ShoppingOrder {
name String required unique minlength(2) maxlength(90)
totalAmount Float min(0)
ordered LocalDate
}
entity ProductOrder {
amount Integer required min(0) max(5)
}
entity Shipment {
shippedAt LocalDate required
}
relationship OneToOne {
Shipment{order(name) required} to ShoppingOrder{shipment(shippedAt)}
}
relationship OneToMany {
ShoppingOrder{orders} to ProductOrder{overallOrder(name) required}
}
relationship ManyToOne {
ProductOrder{product(name) required} to Product
Address{user(login) required} to User
ProductOrder{buyer(login) required} to User
ShoppingOrder{buyer(login) required} to User
Shipment{shippedBy(login) required} to User
}
service * with serviceImpl
dto * with mapstruct
How Does JHipster Help?
Preselection: JHipster slides:
- Framework: Spring Boot is part of JHipster core. All other options need plugins (see the Plugins section below).
- Language: Java is the default back-end language. We can use Kotlin through a plugin. Using .Net or Node.js switches the language to C# or JavaScript.
- Architecture: We can either generate a monolith or microservices. See this section of the JHipster website for details on the microservices architecture.
- Build tool: That’s either Maven or Gradle.
- Authentication: We had the choice of JWT, OAuth 2, or session-based authentication. See this section of the JHipster website for details.
- Caching: JHipster offers several caching options. See this section of the JHipster website for details.
- Tests: JHipster creates unit tests by default. Optionally, you can include frameworks for end-to-end web tests or performance tests. JHipster picks and configures the frameworks there, but you still need to write the tests yourself. See here for details.
- Continuous Integration: JHipster creates the configuration files for all popular CI frameworks. The JHipster site has the details.
- Deployment: The “Production” section of the JHipster website describes the deployment. The sidebar on the left lists the available options.
- Monitoring: JHipster has a built-in dashboard. It also supports other monitoring systems. See the JHipster website for details.
Getting Started with JHipster
For the latest information, always check the JHipster site.
My Tutorial
If you wanted to get started with JHipster, my three-part JHipster tutorial was just what you needed:
- The first part is optional. It tells the story of how JHipster and Docker saved my first Angular Java project.
- The second part helped with installing JHipster. We then generated our first JHipster application and explored the UI for administration and our entities.
- In the third and final part, we looked at the JHipster code: configuring Eclipse/IntelliJ, importing the project, and inspecting the code.
Plugins
Plugins change the code that JHipster generates. They’re optional; JHipster calls them “blueprints”.
Here are the officially supported blueprints:
- Kotlin
- Vue.js (which moved into the JHipster core with the then-upcoming JHipster 7 release)
- .Net
- Node.js
- Micronaut
In principle, we could use multiple blueprints at the same time. But it seemed that at least the Kotlin blueprint didn’t go together with other blueprints.
The JHipster site’s list of all blueprints also included the Quarkus blueprint, for instance.