Java Annotations

Spring Core Annotations

  1. @Configuration: It is used to declare a java class as Spring Configuration.
  2.  @Bean: Itis used to replace <bean> tag of the XML configuration.
  3. @ComponentScan: It is used to enable Spring Annotations and scan Sterotype annotations. It is
    replacement of tag: <context:component-scan/>
  4. @Component: Indicates that an annotated class is a “spring component”.
  5. @Service: Specialization of @Component for service layer.
  6. @Repository: Specialization of @Component for data layer
  7. @Controller. Specialization of @Component for web layer.
  8. @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.
  9. @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.

Tags: No tags

Leave A Comment

Your email address will not be published. Required fields are marked *