spring framework / spring boot
tightly couple / loose couple
AnnotationConfigApplicationContext에 등록
질문 리스트
Spring container란? ( = spring context) / IOC container
Java Bean vs Spring Bean
Spring bean이 관리하는 모든 bean framwork를 listup 하는 법
Arrays.stream(context.getBeanDefinitionNames())
.forEach(System.out::println);
일치하는 context(bean)가 여러개일 경우
configuration 파일 생성 → bean생성
try catch문으로 context 누수 방지
질문 5. 스프링은 객체를 관리하고 Auto-wiring을 해준다
Dependency Injection(의존성 주입)
@Autowired(생략 가능)
public YourBusinessClass(Dependency1 dependency1, Dependency2 dependency2) {
System.out.println("Successful create");
this.dependency1 = dependency1;
this.dependency2 = dependency2;
}
@Autowired
public void setDependency1(Dependency1 dependency1) {
System.out.println("Setter Injection - setDependency1");
this.dependency1 = dependency1;
}
@Autowired
public void setDependency2(Dependency2 dependency2) {
System.out.println("Setter Injection - setDependency2");
this.dependency2 = dependency2;
}
Field
@Autowired
Dependency1 dependency1;
@Autowired
Dependency2 dependency2;
Component
Dependency Injection
Component vs Bean