Skip to content
Sharp

Spring Core · interview question

What does the @Bean annotation indicate in a Spring Boot application?

Multiple choiceEasychapter-9-curatedpremiumspring-coreinversion-of-control-ioc
Choose one answer
Answer and explanation

Correct answer

A. A method produces a bean to be managed by the Spring container.

Why

The @Bean annotation marks a method as a producer of a bean that the Spring container manages. These methods are typically within @Configuration classes and define specific components or services needed by the application.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →