9. Pop Quiz Q. Constructor injection Setter injection
Setter injection should primarily only be used for optional dependencies that
can be assigned reasonable default values within the class. Otherwise, not-
null checks must be performed everywhere the code uses the dependency.
One benefit of setter injection is that setter methods make objects of that
class amenable to reconfiguration or re-injection later. Management
through JMX MBeans is therefore a compelling use case for setter injection.
Spring Docs. Core Technologies Constructor-based or setter-based DI?
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans-beanfactory
10. Pop Quiz Q. Constructor injection Setter injection
Setter injection should primarily only be used for optional dependencies that
can be assigned reasonable default values within the class. Otherwise, not-
null checks must be performed everywhere the code uses the dependency.
One benefit of setter injection is that setter methods make objects of that
class amenable to reconfiguration or re-injection later. Management
through JMX MBeans is therefore a compelling use case for setter injection.
Spring Docs. Core Technologies Constructor-based or setter-based DI?
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans-beanfactory
11. Pop Quiz Q. Constructor injection Setter injection
Setter injection should primarily only be used for optional dependencies that
can be assigned reasonable default values within the class. Otherwise, not-
null checks must be performed everywhere the code uses the dependency.
One benefit of setter injection is that setter methods make objects of that
class amenable to reconfiguration or re-injection later. Management
through JMX MBeans is therefore a compelling use case for setter injection.
Spring Docs. Core Technologies Constructor-based or setter-based DI?
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans-beanfactory
플랫폼 혹은 사용자에 의해 만들어진 모니터링용 객체.
12. Pop Quiz Q. Constructor injection Setter injection
https://docs.jennifersoft.com/4.5manual#21e215be955d9cbd
14. @Autowired Troubleshooting
public interface {
}
@Service
public class interface {
@Autowired
;
}
@Repository
public class interface {
}
@Repository
public class interface {
}
?
23. Resource - 빈 이름(id)을 통해 자동 주입(@Autowired + @Qualifier)
- 필드명과 동일한 이름의 빈을 주입
- 필드명과 빈 이름이 다르면 @Resource(name=“…”)
@Autowired Troubleshooting
Stereotype ex. @Respository(“ ”)
24. Resource - 빈 이름(id)을 통해 자동 주입(@Autowired + @Qualifier)
- 필드명과 동일한 이름의 빈을 주입
- 필드명과 빈 이름이 다르면 @Resource(name=“…”)
@Autowired Troubleshooting
Stereotype ex. @Respository(“ ”)