@Bean
annotation is used to create beans for the application context, we can put the logic inside it to create an object.
But can we call this method manually somewhere in our code, where the reference of the bean being created is not autowired ???
I can call this method, but is it a good practice ? If I am calling this then does that not mean that I have not designed my class dependencies correctly ??
Can someone please share their thoughts on this ?
Thanks,
Amar