2

What is the difference between @Component and @Beans in @Configuration classes? Which one should I use?

I tried both ways: in any way I can get singleton beans or bean factories (e.g. prototype scope). The app works correctly in any solution, so i guess this question is a matter of architecture.

  • It's better to use @Bean in configuration classes. See here for more details: https://stackoverflow.com/questions/10604298/spring-component-versus-bean – Igor Kanshyn Jan 03 '23 at 23:23

0 Answers0