Questions:
1) Difference between @Component
and @Configuration
?
I have read that both remove the necessity of
On the difference between @Autowired
, @Inject
and @Resource
you can look here. Here you can thorough description and comparison.
What concerns the first difference: @Configuration
is used as replacement for XML
-based configuration, ie. it marks classes as the ones used for Java
-based configuration, see here. In turn, @Component
is actually used to mark classes as the ones to be instantiated by Spring
and @Configuration
is meta-annotated by @Component
annotation.
@Component
and @Configuration
serve different purposes so it doesn't make sense to compare them.