2

Full @Configuration vs “lite” @Bean mode? In Spring documentation they have mentioned something about @Bean annotated method without @Configuration annotated class. Can anyone please help me to get perfect example and where can it useful(in which case)?

https://docs.spring.io/spring-framework/docs/current/reference/html/core.html#beans-standard-annotations (Concept : 1.12.1)

  • 2
    Just don't use it, it will lead to more problems than it solves. It basically acts as a factory method (as the documentation states) and for each bean that needs an instance of that bean it will create a fresh one (while most will think it will also produce a singleton). – M. Deinum Jan 04 '22 at 13:16
  • Okay So you mean to say it will act as prototyped bean but originally singletone. Correct? – Maunish Shah Jan 05 '22 at 15:21

0 Answers0