Spring Core Annotations
- @Configuration: It is used to declare a java class as Spring Configuration.
- @Bean: Itis used to replace <bean> tag of the XML configuration.
- @ComponentScan: It is used to enable Spring Annotations and scan Sterotype annotations. It is
replacement of tag: <context:component-scan/> - @Component: Indicates that an annotated class is a “spring component”.
- @Service: Specialization of @Component for service layer.
- @Repository: Specialization of @Component for data layer
- @Controller. Specialization of @Component for web layer.
- @Qualifier: The @Qualifier annotation is used to resolve the autowiring conflict when there are multiple beans of the same type. The @Qualifier annotation can be used on any class annotated with @Component or on methods annotated with @Bean. This annotation can also be applied to constructor arguments or method parameters.
- @Autowired annotation is applied to the fields, setter methods, and constructors. It injects object dependency implicitly. We use @Autowired to mark the dependency that will be injected by the Spring container.