Skip to content
Sharp

Dependency Injection · interview question

Why do teams use the @Autowired annotation in Spring Boot in production code?

Multiple choiceEasychapter-9-curatedpremiumdependency-injectionconstructor-vs-field-injection
Choose one answer
Answer and explanation

Correct answer

A. To automatically inject dependencies into a bean.

Why

The @Autowired annotation tells Spring to automatically inject the required dependencies into a bean, reducing boilerplate code and improving modularity.

Test yourself on Dependency Injection

A free test with instant, explained results. No account needed.

Start free test
All Dependency Injection questions →