Spring Annotations

If you want to develop a Spring Application you need to know when to use which Annotation.

Dependency Injection

Spring’s dependency injection capability includes the following annotations:

AnnotationExplanation
@ComponentGeneric stereotype for any Spring-managed component.
@Service Indicates that an annotated class is a service.
@ValueInjection mechanism for fields and methods that indicates a default value. Often used to get values from property files.
  
  


Configuration

AnnotationExplanation
@QualifierAssociates a value with a particular argument. More finely tuned way than @Order and @Priority to control selection.
@ProfileIndicates that a component is eligible for registration when one or more specified profiles are active. You can also use @Profile({"default"}) to define a default profile, if no Profile is actively selected.