DI(Defendency Inject)

public class Car {
	//결합도가 강하다(높다)
	private Engine engine = new Engine();
	//결합도가 강하다(높다)  
	public Car(){
		this.engine = new Engine();
	}

	//결합도가 약하다(낮다)
	public Car(Enging engine){
		this.engine = engine;
	}
	//결합도가 약하다(낮다)
	public void setEngine(Engine enginge){
		this.engine = engine;
	}
	
}

public class Engine{

}

-------------------------------------
Car car = new Car();

Engine engine = new Engine();
car.setEngine(engine);

객체 생성

1. Annotation
	 @Controller("bean의 이름 지정")      : 객체 생성, Constroller 역할
	 @Service("bean의 이름 지정")         : 객체 생성, Service 역할
	 @Repository("bean의 이름 지정")      : 객체 생성, DAO 역할
	 @Component("bean의 이름 지정")       : 객체 생성, 그외 클래스
	 
	 클래스 선언부 위에 작성
	 
	 Beand의 이름을 지정하지 않으면 클래스명의 첫글자를 소문자로 바꾼것이
	 Bean의 이름으로 만들어 짐
	

객체 주입

1. Annotation
	
	 @Autowired
	 --1 . 같은 타입을 찾아서 주입
	 --2 . 여러개일 경우 변수명 Bean의 이름이 같은 것을 찾아서 주입
	 @Qulitifier("bean의이름")
	 

	public class Car{
		@Autowired
		@Qulitifier("bean의이름")
		private Engine engine;
		
		public Car(@Autowired Engine engine){}
		
		@Autowired
	  public void setEngine(@Autowired Engine engine){}

}