Is the Dependency Inversion Principle the same as Dependency Injection?... While Dependency Injection refers to the injection of Dependencies into a class... Which type of Dependency Inj
Trang 1Each Question will be displayed for 10 seconds
If you need more time, just press pause
Trang 2Who is the original author of the
SOLID Principles of OOP?
Trang 3Robert “Uncle Bob” Martin
Trang 4What principle is the ’S’ in
SOLID?
Trang 5Single Responsibility Principle
Trang 6Is the Dependency Inversion Principle the same as Dependency
Injection?
Trang 7No, Dependency Inversion addresses abstractions While Dependency Injection refers
to the injection of Dependencies into a class.
Trang 8What are the three types of
Dependency Injection
Trang 9• By Property
• By Setter
• By Constructor
Trang 10Which type of Dependency Injection should you favor?
Trang 11By Constructor - This requires the dependency to be injected when the
class is instantiated
Trang 12Can you use Dependency Injection against a private property in Spring?
Trang 13Yes, Spring will support this, and inject the
dependency using reflection at runtime
However, this is considered a VERY bad
practice.
Trang 14Is it good practice to use concrete classes for dependency injection?
Trang 15No You should use interfaces, which will allow the runtime environment to determine the implementation to inject.
Trang 16What is IoC?
Trang 17Inversion of Control - the runtime environment (or framework) which
injects dependencies
Trang 18What is the ‘L’ in SOLID?
Trang 19Liskov Substitution Principle, by
Barbara Liskov
Trang 20What is the annotation used in Spring to indicate you want a
dependency injected?
Trang 21@Autowired
Trang 22If you have two beans of the same
type, how do you specify a preference for one over the other?
Trang 23The @Primary annotation can be used to designate a primary bean
Trang 24What are the two callback interfaces
you can implement to tap into the
bean lifecycle?
Trang 25InitializingBean and
DisposableBean
Trang 26What two annotations can be used
to access the Spring Bean lifecycle?
Trang 27@PostContstuct and
@PreDestroy
Trang 28How do you specify a bean
name you want injected?
Trang 29Use the @Qualifier annotation