'dependency injection'
definition
In software engineering, dependency injection is a technique in which an object receives other objects that it depends on, called dependencies. Typically, the receiving object is called a client and the passed-in object is called a service. The code that passes the service to the client is called the injector. 'Wikipedia'
소프트웨어 공학에서 의존성 주입은 의존이 필요한 객체를 수신하여 의존성을 주입받는 기술이다. 일반적으로, 수신 객체를 클라이언트 그리고 전달된 객체를 서비스 라고 부릅니다. 서비스를 클라이언트에 전달하는 코드를 인젝터라고 합니다. '위키피디아'
types
Constructor Injection
Setter Injection
Interface-based Injection
생성자 주입, 세터 주입, 인터페이스 기반 주입 방식이 있다.
adventages
- Dependency injection allows a client the flexibility of being configurable.
- Can be used to externalize a system's configuration details into configuration files, allowing the system to be reconfigured without recompilation.
- Separate configurations can be written for different situations that require different implementations of components. - This includes, but is not limited to, testing.
- Due to decoupling, the reusability of the code is increased.
- Improved code maintainability and testing.
- It can be applied to legacy code as a code refactoring.
- The ease of testing is often the first benefit noticed when using dependency injection.
- It allows reduction of boilerplate code in the application objects, since all work to initialize or set up dependencies is handled by a provider component.
'Certification > Spring(2V0-72.22, SCP)' 카테고리의 다른 글
What is the difference between checked and unchecked exceptions? (0) | 2021.11.07 |
---|---|
What is the concept of AOP? Which problem does it solve? What is a cross cutting concern? (0) | 2021.11.06 |
Spring MVC - 게시판 페이징 처리 (0) | 2018.10.26 |
iBatis Mapper Null 값 치환하기 (0) | 2018.10.25 |
Controller @RequestMapping 리턴 타입 (0) | 2018.10.04 |