Simplifying Jakarta EE

While simplifying an application originally designed for GlassFish, I discovered that Jakarta EE can be used in a much smaller form than what is commonly presented.

It is not necessary to implement the entire enterprise stack. Depending on the problem you are trying to solve, only the required components need to be used to build the application.

A Minimal Web Architecture

             Browser
                |
                ▼
        Jakarta Servlet
                |
                ▼
          Service Layer
                |
                ▼
              JDBC
                |
                ▼
            Database

View Layer

Servlet
   |
   ▼
Thymeleaf
   |
   ▼
HTML

Web Server

Java Main
   |
   ▼
Embedded Jetty
   |
   ▼
Servlet Container

A Complete Jakarta EE Server

GlassFish normally provides a complete enterprise ecosystem including:

  • Servlet
  • CDI
  • JPA
  • EJB
  • JAX-RS
  • JMS
  • Security
  • Server Administration

However, not every application requires all of these technologies.

A Lightweight Alternative

In my case, by removing layers that were not required, the architecture became much simpler:

  • Java SE as the foundation.
  • Jakarta Servlet for HTTP processing.
  • Thymeleaf for HTML rendering.
  • JDBC for data persistence.
  • Embedded Jetty as the servlet container.
  • Security Filters.

This is still an enterprise Java application, but using only a fraction of the Jakarta EE ecosystem.

Persistence can be implemented directly with JDBC or through ORM technologies such as JPA/Hibernate. In this architecture, JDBC is used to keep the design minimal and to clearly demonstrate the fundamentals of data access.

Why This Approach?

One of the main advantages of this architecture is that it helps developers better understand the foundations of a Java web application: HTTP requests, servlets, layered architecture, database access, and HTML view generation before introducing frameworks that automate part of this work.

The goal is not to replace enterprise frameworks or application servers, but to understand that many modern Java solutions are built upon these same fundamentals.


Related Project
The concepts described in this article are part of the architecture used in AppDTE Community, an Open Source REST API developed in Java for Chilean Electronic Invoicing (DTE).

Comments

Popular posts from this blog

Building a Simple Web Form with Jetty and Servlets

Creating a MySQL Connection Class in Java

Replacing Tomcat: Configure Jetty with Spring Boot