O'Reilly logo
live online training icon Live Online training

Structural Design Patterns with Spring

Topic: Software Development
Victor Rentea

Design Patterns are a powerful tool. So powerful that if applied carelessly they can get you into horrible overengineered code. Mastering the underlying principles and knowing why, how, the cost and nuances of applying a pattern can have a huge impact on your code on the long run. Design patterns have evolved dramatically since the classic GoF book: some died, a few amazing ones appeared while others became incredibly simple to implement with Spring and Java 8. However, the underlying principles never changed. We’ll dive deep into these principles, guided by an eXtreme Programming attitude towards a simple, clean, maintainable and testable design. Along the way, besides practicing a lot of refactoring, we’ll uncover some of the most important mechanics lying under the hood of the Spring Framework – by far the most widely used framework in the Java community.

What you'll learn-and how you can apply it

  • Design clean maintainable code by applying good software design principles like SRP, DRY, KISS, SOLID
  • Understand what Aspect Oriented Programming (AOP) is and how it can be implemented, using Class-Proxies
  • Learn about the Proxy Pattern
  • Understand how the Spring Framework performs most of its “magic”, like @Cacheable, @Transactional, @Secured, @Async...
  • Learn to decouple interactions with external systems using Dependency Inversion Principle applied to an Adapter Pattern
  • Learn to shield internals using a Facade Pattern, and its flavors

This training course is for you because...

  • You’ve been developing with Spring for a while already, but you want to know more about its internals
  • You want a refresh on good software design principles and refactoring techniques
  • You want to see application of patterns today in modern applications built with Spring
  • You need an infusion of energy and enthusiasm


  • Prior contact with the Spring Framework is highly recommended by not mandatory
  • Basic knowledge of the Adapter, Facade, and Proxy patterns would help

Recommended Preparation

Recommended Follow-up

About your instructor

  • Victor Rentea is a Java Champion and Associate Professor at Politehnica University of Bucharest. He has been writing code for over two decades in many programming languages, and has lead 7 projects at IBM.

    Since 2012 he helped thousands of developers become better via training sessions day-to-day coding topics, assembling an extensive curricula that cover most of the software best practices and technologies of a typical Java application. Today, over 40 companies throughout the world call him for training sessions for their employees. You can read their opinion on LinkedIn, his Facebook page, and on victorrentea.ro. Recently, key parts of his courses became accessible to anyone on Teachable.

    Victor is best known for the energy and depth of his top-rated talks at renowned conferences. You will feel the same energy in any of his training sessions. To share his passion for Clean Code and Unit Testing, he founded the Bucharest Software Craftmanship Community, one of the largest developer communities today in Romania. You can also find him posting regularly on Twitter, LinkedIn and Facebook.


The timeframes are only estimates and may vary according to how the class is progressing

Part 1: Adapter Pattern and Dependency Inversion – Live Coding + Slides (45 min)

  • General Principles: SRP, Coupling, KISS, YAGNI, encapsulate what varies
  • Adapter Pattern definition
  • Extracting an Adapter from domain logic (Live-Coding)
  • Dependency Inversion Principle

Q&A (10 min)

Break (5 minutes)

Part 2: AOP: Proxy and Decorator Patterns – Live Coding (60 min)

  • Manually Creating Class Proxies using CGLIB
  • Undestanding Spring AOP
  • Working with Spring @Aspect
  • Aspects: debugging tips, best practices, alternatives

Q&A (10 min)

Break (5 minutes)

Part 3: Facade and an Evolutionary Architecture – Slides (35 min)

  • Facade overview
  • A typical layered architecture application. Boundaries.
  • Facade roles in an enterprise application
  • The Onion Architecture and the “Pragmatic Onion”

Q&A (10 min)