Week 9 of #100DaysOfCode: A Week of Deep Spring Learning
Introduction This week, I decided to slow down and go deeper into the Spring Framework . Instead of focusing heavily on building new features, I spent most of my time understanding what happens behind the scenes in the framework I use to build backend applications. I explored concepts around Spring AOP, JDBC, Caching, Reactive Programming, and Concurrency , learning not just how to use these…
Week 9 of #100DaysOfCode: A Week of Deep Spring Learning
Introduction
Last week, I took a step back to gain a deeper understanding of the Spring Framework. Instead of focusing on building new features, I spent most of my time exploring the underlying mechanisms of the framework used for building backend applications. I delved into topics such as Spring AOP, JDBC, Caching, Reactive Programming, and Concurrency, not just learning how to use these features but also understanding the problems they aim to solve.
While applying for backend engineering opportunities and preparing for technical interviews, I maintained my consistency with the #100DaysOfCode challenge.
Day 52: Understanding Spring Caching
Today, I began learning about Spring Caching and its role in improving application performance. My key takeaways include:
- The concept of caching and where it can be utilized
- How Spring's Cache Abstraction functions
- The roles of Cache and CacheManager
- Different cache providers available
- How caching can minimize repeated executions and avoid unnecessary database calls
- The Proxy Pattern used by Spring to apply caching behavior
- Various caching annotations, including @Cacheable, @CachePut, @CacheEvict, @Caching, and @CacheConfig
- How Spring uses AOP and Around Advice to implement caching
One significant insight was that caching is an example of how Spring applies AOP to separate cross-cutting concerns from business logic. Instead of incorporating caching logic directly into business methods, Spring can apply it around those methods through proxies. Additionally, I began to understand that caching is not merely about storing data; the application must decide what should be cached, how the cache should be configured, and when cached data should be updated or removed.
Day 53: Complete reading Spring Caching
Today, I continued learning about Spring Caching, building upon the knowledge acquired the previous day. My understanding deepened on these aspects:
- Enabling Spring's caching abstraction using @EnableCaching
- Roles of @Cacheable, @CachePut, and @CacheEvict annotations
- Configuring cache storage
- Caching best practices
- How Spring employs AOP and Around Advice to apply caching behavior
This reinforced my understanding of how Spring manages caching behind the scenes, distinct from adding caching logic directly into business methods. Spring utilizes AOP to apply caching behavior via proxies, connecting with the concepts of cross-cutting concerns and Spring AOP previously learned.
Day 54: Getting Started with Reactive Design Patterns
I embarked on learning Reactive Design Patterns in Spring, focusing on the importance of reactive programming for modern applications. Key insights included:
- The need for reactive programming due to modern applications needing to handle large-scale concurrency
- Differences between blocking and non-blocking calls
- Principles of reactive systems, including responsiveness, resilience, scalability, and message-driven architecture
- How reactive systems are designed to handle high traffic and concurrency
This introduction to reactive programming provided a foundation for understanding how Spring supports reactive applications.
Day 55: Understanding Reactive Streams and Spring Web Reactive
Today, I delved deeper into Reactive Programming with Spring, focusing on the handling of asynchronous data and concurrent requests. Key learnings included:
- What Reactive Streams are
- The concept of back-pressure in reactive systems
- The Reactor framework
- The four Reactive Streams interfaces: Publisher, Subscriber, Subscription, and Processor
- Differences between Spring MVC and Spring Web Reactive
- How blocking and non-blocking request handling differ
A crucial insight was the concept of back-pressure, which enables a consumer to control how much data it can handle from a producer, preventing system overload. Additionally, I learned that Spring Web Reactive is designed for non-blocking request processing, making it suitable for applications requiring efficient handling of concurrent operations.
Day 56: Completing Reactive Design Patterns
Today marked the completion of the Reactive Design Patterns chapter, further solidifying my understanding of how Spring builds reactive web applications. Key learnings included:
- The functional programming model for reactive applications
- RouterFunction and HandlerFunction
- Working with Mono and Flux
- Creating reactive servers using Reactor and Tomcat
- Using Spring WebClient for reactive client-side communication
- Reactive request and response body conversion using Encoder and Decoder
- How Spring supports both annotation-based and functional programming models for reactive applications
- Handling data using non-blocking streams in reactive applications
Completing this chapter connected various concepts learned in recent days, from reactive systems and back-pressure to Reactive Streams, Reactor, and Spring Web Reactive. Although an unfamiliar area, I now have a better understanding of how Spring approaches asynchronous and non-blocking programming.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.