Skip to content
Sharp

Spring Core · interview question

Which Spring annotation is used to define a method that should be executed after a bean's properties have been set?

Multiple choiceMediumchapter-9-curatedpremiumspring-corebean-scope
Choose one answer
Answer and explanation

Correct answer

B. @PostConstruct

Why

@PostConstruct is used to define a method that should be executed after the bean's properties have been set. It ensures that any initialization logic is run after dependency injection is complete.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →