DEV Community

Cover image for πŸš€ Building Spring by Example: Completing the OpenMRS Examples Module
Mujuzi Moses ο£Ώ
Mujuzi Moses ο£Ώ

Posted on

πŸš€ Building Spring by Example: Completing the OpenMRS Examples Module

When I started learning Spring, I noticed something about many of the tutorials I found.

They often showed how to use a feature, but not always what was happening behind the scenes or how the different pieces of the framework worked together.

I learn best by building things and documenting what I discover, so I started a project called spring-by-example.

The idea is simple: instead of building one large application, I’m creating a collection of small, focused examples where each example explores a specific Spring concept with clear explanations, tests, and documentation.

I’m happy to say that I’ve now completed Module 14 - OpenMRS Examples. πŸŽ‰

But this milestone is a little more significant than completing another module.

Module 14 is the final module and final example of Spring by Example V1.

That means V1 of spring-by-example is now complete. πŸš€

From Learning Spring to Studying Real-World Code

This module was different from the previous ones because it moved away from studying Spring only through isolated examples and focused on how Spring concepts are applied in a real-world, open-source application.

For this module, I used OpenMRS as the real-world reference.

OpenMRS is an open-source electronic medical record platform, and its codebase provided a much more realistic environment for exploring how Spring is used in a large application.

Instead of simply asking:

"How does this Spring feature work?"

I wanted to ask:

"How is this Spring feature actually used in a real application?"

and:

"Why was it implemented this way?"

The goal of this module was not to reproduce the entire OpenMRS codebase.

Instead, I created focused examples based on patterns and concepts found in OpenMRS, while keeping each example small enough to understand independently.

The module explored areas such as:

  • Service Registration
  • Module Loading
  • XML to Java Configuration
  • OpenmrsBeanRegistrar
  • ServiceContext
  • AOP in OpenMRS
  • Transaction Management
  • Custom Spring Profiles

One of the things I found particularly valuable was seeing how the concepts from the previous modules connect when they're no longer isolated examples.

For example, after learning about dependency injection, bean definitions, BeanPostProcessor, transactions, and AOP proxies, it's one thing to understand each concept individually.

It's another thing to encounter them together in a real application and understand why they are there and how they interact.

That was one of the main goals of this module.

The Journey Through V1

The progression of Spring by Example V1 now looks something like this:

Spring Core
     β”‚
     β–Ό
Dependency Injection
     β”‚
     β–Ό
Bean Lifecycle
     β”‚
     β–Ό
Events
     β”‚
     β–Ό
AOP
     β”‚
     β–Ό
Transactions
     β”‚
     β–Ό
Spring Boot
     β”‚
     β–Ό
Spring MVC
     β”‚
     β–Ό
Testing
     β”‚
     β–Ό
Advanced Spring
     β”‚
     β–Ό
Spring Internals
     β”‚
     β–Ό
OpenMRS Examples
     β”‚
     β–Ό
   V1 DONE πŸŽ‰
Enter fullscreen mode Exit fullscreen mode

Looking back at the progression, each module added another layer of understanding.

I started with the fundamentals of Spring and gradually moved into dependency injection, bean lifecycle, events, AOP, transactions, Spring Boot, Spring MVC, testing, and more advanced Spring concepts.

Then I went deeper into Spring Internals to understand what was happening behind many of those features.

Finally, OpenMRS Examples brought those ideas into the context of a real-world application.

What I Took Away

One of the biggest lessons from this journey is that understanding a framework isn't only about knowing its annotations and APIs.

It's also about understanding how those pieces are used together to solve problems in a larger system.

A simple annotation such as @Autowired or @Transactional can look straightforward when used in a small example.

In a real application, however, it can be connected to configuration, proxies, bean lifecycle processing, transactions, service layers, persistence, testing, and many other parts of the system.

Looking at these interactions made the concepts from the earlier modules feel much more concrete.

The goal of the project was never to simply collect Spring annotations and interfaces.

I wanted to understand how Spring works, why these features exist, and how the different pieces fit together.

Building small examples made the concepts easier to explore.

Studying Spring's internals helped me understand what was happening underneath.

And studying OpenMRS helped me see how those concepts can come together in a much larger application.

V1 Is Complete

After all the modules, examples, tests, documentation, and experiments, Spring by Example V1 is officially complete. πŸŽ‰

This isn't the end of the project.

It's the end of V1.

The project started as a way for me to learn Spring by building small examples instead of simply reading about the framework.

Over time, it grew into a structured journey through different areas of the Spring ecosystem.

And now I have a complete V1 that I can look back on as a record of what I learned.

The next stage will be about deciding what Spring by Example V2 should look like and where to take the project from here.

For now, though, I'm taking a moment to appreciate reaching this milestone.

14 modules.

One focused example at a time.

Spring by Example V1 β€” complete. πŸš€

Open Source

The project is open source, and the complete V1 is available here:

πŸ”— GitLab https://gitl.ab/gfDEyGH3

πŸ”— GitHub https://gith.ub/dsAQrAU5

Completing Module 14 - OpenMRS Examples helped me connect those concepts to a real-world application.

And completing Module 14 means something even bigger:

The final example of Spring by Example V1 is complete.

There’s still a long way to go, but reaching this milestone feels like an important point in the journey. πŸš€

Spring by Example V1 β€” DONE.

Now, let's see what V2 brings.

java #springframework #opensource #github #learninginpublic #backend #softwareengineering #spring #springboot #openmrs #programming

Top comments (0)