목록분류 전체보기 (50)
Kim Hyeong
Setter로 DI 주입 package com.spring4.practice01; public interface Car { public String brand(); } package com.spring4.practice01; public class CarHDImpl implements Car { public String brand(){return "자동차는 현대자동차 소나타입니다.";} } package com.spring4.practice01; import org.springframework.beans.factory.annotation.Autowired; public class Service { private Car car;public Service(){} public void setCar(Car ca..
생성자를 이용한 DI 설정 package com.spring4.practice01; public interface Car {public String brand();} package com.spring4.practice01;public class CarHDImpl implements Car {public String brand(){return "자동차는 현대자동차 소나타입니다.";}} Car 인터페이스를 구현한 CarHDImpl을 만든다. package com.spring4.practice01;import org.springframework.beans.factory.annotation.Autowired;public class Service {private Car car;public Service(){} /..