스프링에서 관리하는 객체를 빈(Bean)이라고 하고, 해당 빈들을 관리한다는 의미로 컨테이너를 빈 팩토리(Bean Factory)라고 한다.



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.beyond</groupId>
<artifactId>di</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>01_SpringDI</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>


Owner owner = new Owner();
owner.setName("임꺽정");
owner.setAge(32);
// 메소드를 통한 의존성 주입
owner.setDog(new Dog("댕댕이"));
// 생성자를 통한 의존성 주입
Owner owner = new Owner("홍길동", 30, new Dog("멍멍이"));
https://github.com/mjms0214/BEYOND_SW_CAMP_8/tree/main/framework/01_SpringDI