viernes, 4 de junio de 2021

SpringIoC From Tight to Loose Coupling, Debug, Error Messages

From Tight to Loose Coupling with Spring IoC (Inversion of Control)

https://github.com/jalbertomr/SpringIoC.git 

Highly Coupled Classes


To Run other Class is needed modify Classes


Decoupling a little using Interface

To change the game just change the new Class for GamingConsole game variable.




Decoupling using sprinc IoC
Creating Context from Spring to use the beans.   (Ctrl+1 to create new local variable).


Is proposed the names, between them context.


There in no needed to use new to instantiate any class, Spring IoC do the job for you.


Add @Component  and @Primary

Specifying where packages to find the beans.




To Debug spring framework






Forcing  Spring to not find the bean to show the respective error message.


Dependency Injection using Constructor


Dependency Injection using Setter.

Dependency Injection using Field


eot