반응형

의존성 주입 2

has-thumbnail="1" style="background-image:url('https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fcw4k0z%2FbtqYn44Lk9O%2FTwtdOSfW2RUusSNNCI5YsK%2Fimg.png')"

[Spring] 스프링 삼각형1_IoC/DI

스프링 삼각형 -스프링 삼각형은 스프링의 3대 프로그래밍 모델(IoC/DI, AOP, PSA)을 의미합니다. -스프링을 이해하기 위해서는 POJO(Plain Old Java Object)를 기반으로 스프링 삼각형에 대한 이해가 필수입니다. 1. IoC(Inversion of Control)/DI(Dependency Injection)-제어의 역전/의존성 주입 2. AOP(Aspect-Oriented Programming)-관점 지향 프로그래밍 3. PSA(Portable Service Abstraction)-일관성 있는 서비스 추상화 IoC/DI-제어의 역전/의존성 주입 프로그래밍에서의 의존성이란? new Car(); Car 객체 생성자에서 new Tire(); 의존성은 new이다. new를 실행하는 C..

Spring/additional 2021.02.28

[Spring] 스프링을 통한 의존성 주입

스프링을 통한 의존성 주입-@Autowired vs. @Resource vs. 태그 1) XML 설정-한 개의 빈이 id 없이 tire 인터페이스를 구현한 경우 //expert006.xml .... //Car.java-@Resource를 이용한 tire 속성 주입 public class Car { @Resource Tire tire; public String getTireBrand() { return "장착된 타이어: "+tire.getBrand(); } } //Car.java-@Autowired를 이용한 tire 속성 주입 public class Car { @Autowired Tire tire; public String getTireBrand() { return "장착된 타이어: "+tire.getBr..

Spring/additional 2021.02.28
반응형