Reputation: 1
We all know that both these annotations are used to create beans. But if @Component was already there to create bean then what was the need of @Configuration (which use @Bean) to create bean. Please help in understand this and in which scenario we need to use the annotation.
Upvotes: 0
Views: 93
Reputation: 305
Check this link :
Difference between @Component, @Service, @Controller, and @Repository in Spring
Upvotes: 1
Reputation: 169
Suppose if you need to configure any third party class (like JdbcTemplate, Sendrgrid etc...) as spring bean then you should go with @Configuration annotation. and your business related classes as spring bean then you should go with @Component annotation.
Cheers!
Upvotes: 1