Thesis: Code Generation for Spring with OAW

Model-Driven Architecture for full-scale Spring applications (2008)

Back in July 2008, I finished my thesis. Here are some theoretical details about it and reflections after more than 15 years.

The main goal of my thesis was to implement a full-scale Spring architecture using the Model-Driven Architecture (MDA) approach.

The thesis was innovative at the time since there was not a single scientific work that executed a complete model-to-model and model-to-code transformation for Spring applications.

Influences and Acknowledgments

My main influences back then were Markus Voelter and some great developers at itemis, a company that focused on model-driven generation approaches. I want to thank all the developers who explored this topic with me and provided both practical and theoretical input.

The Classical Spring Architecture

What is a classical Spring architecture? It's the best-practice setup known to developers and architects. The first sketches for this can be found in Rod Johnson's books about Spring.

Classical Spring Architecture (2008)

Presentation Layer

Controllers, Views

Service Layer

Business Logic, Transactions

Data Access Layer

DAOs, Repositories

Domain Model

Entities, Value Objects

Since there was barely any code generation inside the Spring framework back in 2008, but we had a consistent pattern for each entity CRUD cycle, it made a lot of sense to generate the corresponding architecture from a given UML model.

The OAW Framework

The OAW (openArchitectureWare) framework appeared on the horizon with great capabilities for textual editors inside the Eclipse IDE and provided a way to practically implement model-driven generation.

What was still missing at the time was the model-to-model generation part. The motivation behind this was to abstract the business domain from the technical domain at the UML model level — and this became a core part of my thesis.

The Two-Model Approach

I implemented a classical two-model approach that separates concerns:

Platform Independent Model (PIM)

Business domain entities and relationships defined in pure text using a domain-specific language

Platform Specific Model (PSM)

Technical architecture model with Spring-specific implementation details

Model-to-Model Transformation → Model-to-Code Generation

Key Features of the Implementation

Textual DSL Editor

A domain-specific language defining UML-level models in pure text. This was extremely useful for source code management systems and merging changes with the team.

Code Autocomplete

Full IDE support within Eclipse, including syntax highlighting and intelligent code completion for the textual model.

Massive Code Generation

The generated code output was tremendous and covered the entire best-practice Spring architecture — all from a single textual model input.

What Got Generated

From a single textual model definition, the system generated:

  • Domain entities with JPA annotations
  • Data Access Objects (DAOs) with CRUD operations
  • Service layer interfaces and implementations
  • Spring configuration files
  • Controller stubs for the presentation layer

Reflections After 15+ Years

What can I say more than 15 years after writing this thesis?

The Architecture Persists

The Spring architecture is still fundamentally the same, with some variations. The layered approach remains the gold standard for enterprise Java applications.

Convention Over Configuration

I never worked with model-driven generation after this thesis since I moved to the e-commerce space. Modern Spring features now completely generate the database layer. "Convention over configuration" has eliminated much of the needed configuration effort and made code generation obsolete for a significant portion of development work.

Still Relevant for Complex Domains

I still see good use cases specifically for OAW tooling like Xtext for very complex business domains, such as electronics. In these cases, a domain expert can build a custom editor to support software engineers in their work.

Download the Full Thesis

If you want to dive deeper into my thesis, you can download the complete document. Please note that it's written in German.

(Download link available upon request)