Quick Refresh : Spring Boot
What is the core problem that Spring Framework solves? A most important feature of the Spring Framework is Dependency Injection. At the core of all Spring Modules is Dependency Injection or IOC Inversion of Control. Why is this important? Because, when DI or IOC is used properly, we can develop loosely coupled applications. And loosely-coupled applications can be easily unit tested. Let’s consider a simple example: Example without Dependency Injection Consider the example below: WelcomeController depends on WelcomeService to get the welcome message. What is it doing to get an instance of WelcomeService? WelcomeService service = new WelcomeService(); . It’s creating an instance of it. And that means they are tightly coupled. For example : If I create an mock for WelcomeService in a unit test for WelcomeController, How do I make WelcomeController use the mock? Not easy! @RestController public class WelcomeController { private WelcomeService...