Why AppDTE Was Built with Servlets and Embedded Jetty
One of the questions I am often asked is:
Why did you build AppDTE using Embedded Jetty instead of Spring Boot?
The answer is that the architecture was never driven by the framework. It was driven by the problem that needed to be solved.
The Real Challenge
When I started developing AppDTE, I was still learning Java web development.
At that time, my goal was not to compare frameworks or choose between different Java technologies.
The real challenge was implementing the Chilean Electronic Invoicing (DTE) specification.
That meant solving problems such as:
- Generating XML documents according to the SII XML Schemas.
- Building the TED (Electronic Stamp).
- Applying XML Digital Signatures (XMLDSig).
- Validating XML documents.
- Communicating with the Chilean Internal Revenue Service (SII).
- Processing responses and document status.
Compared to these tasks, the web framework was only a small part of the project.
The Evolution of the Project
The project evolved over time.
The first versions were desktop applications built with Swing.
Later, the application became a traditional Java web application using Servlets and JSP.
Eventually, JSP was replaced with Thymeleaf for the administrative interface.
Throughout all these stages, however, the core problem remained exactly the same:
- XML generation
- Electronic stamping
- Digital signatures
- Communication with the SII
The presentation layer changed, but the business logic continued to evolve independently.
A Lightweight Architecture
As the core became more mature, the overall architecture naturally evolved into a lightweight design:
REST Client / Browser │ ▼ Jakarta Servlets │ ▼ Service Layer │ ▼ JDBC │ ▼ MySQL
For the administration interface:
Servlet │ ▼ Thymeleaf │ ▼ HTML
And the application server:
Java Main │ ▼ Embedded Jetty │ ▼ Servlet Container
This architecture proved to be sufficient for the needs of the project while keeping the technology stack relatively small.
Why Embedded Jetty?
Embedded Jetty provided exactly what the project required:
- A lightweight embedded servlet container.
- Standard Jakarta Servlet support.
- Full programmatic configuration.
- Fast startup.
- Minimal runtime dependencies.
- Easy deployment behind a reverse proxy such as Nginx.
The objective was never to use as many technologies as possible, but only those required to solve the problem.
This Is Not About Spring Boot
This article is not intended to compare Jetty with Spring Boot.
Spring Boot is an excellent framework and a great choice for many applications.
However, AppDTE already had a stable architecture centered around standard Jakarta technologies and a business layer that had evolved independently over several years.
Changing frameworks would not simplify the most complex part of the project, because the real complexity was never the web layer—it was the implementation of the electronic invoicing specification itself.
The Importance of Understanding the Fundamentals
One of the biggest advantages of this approach is educational.
Working directly with standard Jakarta technologies makes it easier to understand:
- HTTP request processing.
- The Servlet lifecycle.
- Layered application architecture.
- JDBC database access.
- HTML rendering.
- Embedded server configuration.
These concepts remain the foundation of many modern Java frameworks.
Conclusion
AppDTE was not designed around a particular framework.
Its architecture emerged from the requirements of the problem it needed to solve.
The most difficult part of the project was never building a web application.
It was implementing XML generation, electronic stamping, XML Digital Signatures, and integration with the Chilean Internal Revenue Service (SII).
Once that core became stable, a lightweight architecture based on Java SE, Jakarta Servlets, Embedded Jetty, Thymeleaf, and JDBC proved to be a simple, maintainable, and effective solution.
Related Project
The architecture described in this article is implemented in AppDTE Community, an Open Source REST API developed in Java for Chilean Electronic Invoicing (DTE).
Comments
Post a Comment