Sure!
Here's the converted table with the use of each annotation included in the Purpose column for clarity:
✅ 1. Core Java Annotations (java.lang)
Parameter Where
Annotation Purpose (including use) Example
s to Use
Overrides a superclass method to ensure correctness and avoid
@Override — Method @Override
typos
since,
Marks element as deprecated to discourage usage and indicate Method,
@Deprecated forRemova @Deprecated
it may be removed Class
l
@SuppressWar Method, @SuppressWarnings("
Suppresses specific compiler warnings for cleaner compilation value
nings Class unchecked")
Suppresses unchecked warnings on variable arguments for
@SafeVarargs — Method @SafeVarargs
safer generics
@FunctionalI Indicates the interface is intended to be a functional interface @FunctionalInterfac
— Interface
nterface for lambda use e
☕ 2. Java EE / Jakarta EE Annotations
📦 Dependency Injection (CDI)
Annotation Purpose (including use) Parameters Where to Use Example
@Inject Injects dependent beans automatically for loose coupling — Field, Constructor @Inject
@Named Assigns a name to a CDI bean for referring in EL or injection value Class, Field @Named("myBean")
@Qualifie
Defines custom qualifiers to distinguish between beans — Field, Parameter @Qualifier
r
@Scope("request"
@Scope Specifies bean lifecycle scope (e.g., request, session) value Class
)
📡 JAX-RS (REST API)
Annotation Purpose (including use) Parameters Where to Use Example
@Path Defines REST API path for class or method endpoint value Class, Method @Path("/users")
@GET /
Maps HTTP GET/POST verb to method handler — Method @GET
@POST
@Produces Specifies response media type (e.g., JSON, XML) value Method @Produces("application/json")
@Consumes Specifies accepted request media type value Method @Consumes("application/json")
@PathPara
Binds method parameter to URL path variable value Parameter @PathParam("id")
m
@QueryPar
Binds method parameter to HTTP query parameter value Parameter @QueryParam("q")
am
🧩 3. Spring Framework Annotations
🌱 Core / DI
Paramete Where to
Annotation Purpose (including use) Example
rs Use
@Component("myCom
@Component Declares a generic Spring-managed bean for DI value Class
p")
@Service Marks service layer component for business logic value Class @Service
@Repository Marks DAO or repository layer for data access & exceptions value Class @Repository
@Controller Declares an MVC controller handling web requests value Class @Controller
@RestControl
Specialized controller returning JSON responses directly — Class @RestController
ler
Field,
@Autowired Injects dependency automatically (by type) required @Autowired
Method
@Qualifier("bean1
@Qualifier Resolves bean conflicts by specifying exact bean to inject value Parameter
")
@Value("${app.nam
@Value Injects property or literal values into fields value Field
e}")
@Bean Declares a method producing a Spring bean name Method @Bean
🌐 Spring MVC
Parameter
Annotation Purpose (including use) Where to Use Example
s
@RequestMapp Maps URLs and HTTP methods to controller value, @RequestMapping("/h
Class, Method
ing classes/methods method ome")
@GetMapping("/user"
@GetMapping Shortcut for mapping HTTP GET requests value Method
)
@RequestPara value,
Binds HTTP query parameters to method parameters Parameter @RequestParam("id")
m required
@PathVariabl value,
Binds URI template variables to method parameters Parameter @PathVariable("id")
e required
@ModelAttrib Binds method parameter or return value to model Method, @ModelAttribute("us
value
ute attribute Parameter er")
Maps HTTP request body to POJO (usually JSON to Java
@RequestBody required Parameter @RequestBody
object)
@ResponseBod Indicates method returns value as HTTP response body
— Method @ResponseBody
y (JSON)
@SessionAttr @SessionAttributes(
Declares session-scoped model attributes value Class
ibutes "user")
🧵 4. JPA / Hibernate
Annotatio Where
Purpose (including use) Parameters Example
n to Use
Marks class as a JPA entity mapped to a
@Entity name Class @Entity
database table
name,
@Table Specifies table name and schema for entity Class @Table(name="users")
schema
@Id Declares primary key field — Field @Id
@Generate Specifies strategy for auto-generating primary @GeneratedValue(strategy =
strategy Field
dValue key values GenerationType.IDENTITY)
name,
@Column Maps field to a specific database column Field @Column(name="email")
nullable
mappedBy,
@OneToOne Defines one-to-one entity relationship Field @OneToOne
cascade
@JoinColu
Specifies join column for relationship name Field @JoinColumn(name="user_id")
mn
@Transien
Marks field as non-persistent, ignored by ORM — Field @Transient
t
@Lob Declares large object fields (CLOB/BLOB) — Field @Lob
@NamedQue name, @NamedQuery(name="findAll",
Defines reusable named JPQL query Class
ry query query="...")
🧪 5. Lombok
Paramet Where to
Annotation Purpose (including use) Example
ers Use
@Getter Automatically generates getters — Field, Class @Getter
@Setter Automatically generates setters — Field, Class @Setter
@ToString Generates a toString() method — Class @ToString
@EqualsAndHashCode Generates equals() and hashCode() methods — Class @EqualsAndHashCode
@NoArgsConstructor Generates a no-argument constructor — Class @NoArgsConstructor
@AllArgsConstructor Generates a constructor with all arguments — Class @AllArgsConstructor
@RequiredArgsConstr @RequiredArgsConstr
Generates constructor for final/non-null fields — Class
uctor uctor
Generates getters, setters, equals, hashCode,
@Data — Class @Data
toString
Class,
@Builder Implements builder pattern for object creation — @Builder
Method
@Value Creates immutable class with final fields — Class @Value
@Slf4j Creates a logger instance for logging — Class @Slf4j
🛡️ 6. Bean Validation
Annotation Purpose (including use) Parameters Where to Use Example
@NotNull Ensures field is not null message Field @NotNull
@NotEmpty Ensures field is not null or empty message Field @NotEmpty
@NotBlank Ensures field is not null, empty or whitespace only message Field @NotBlank
@Size Validates size constraints on String, Collection, Array min, max Field @Size(min=3, max=10)
@Min / @Max Validates numeric minimum or maximum value value Field @Min(18)
@Email Validates proper email format — Field @Email
@Pattern(regexp="\\d{10}"
@Pattern Validates field against regex pattern regexp Field
)
@Past /
Validates date fields are in the past or future — Field @Past
@Future
📊 7. Jackson
Annotatio Parame Where to
Purpose (including use) Example
n ters Use
@JsonPro Field,
Defines custom JSON property name for field/method value @JsonProperty("email")
perty Method
@JsonIgn Excludes field/method from JSON Field,
— @JsonIgnore
ore serialization/deserialization Method
@JsonInc @JsonInclude(JsonInclude.Includ
Specifies conditions for including field in JSON output value Class
lude e.NON_NULL)
@JsonFor patter @JsonFormat(pattern="yyyy-MM-
Specifies formatting for dates/enums in JSON Field
mat n dd")
@JsonCre Construct
Marks constructor or factory method for deserialization — @JsonCreator
ator or
🕸️ 8. Servlet
Annotation Purpose (including use) Parameters Where to Use Example
@WebServle urlPatter @WebServlet("/myservlet"
Declares a servlet with URL mapping Class
t ns )
urlPatter
@WebFilter Declares a servlet filter with URL mapping Class @WebFilter("/*")
ns
@WebListen
Declares a listener for lifecycle events — Class @WebListener
er
🎭 9. AOP (Spring)
Annotation Purpose (including use) Parameters Where to Use Example
@Aspect Declares class as an aspect for cross-cutting concerns — Class @Aspect
@Before Defines advice to run before matched method execution value Method @Before("execution(...)")
@After Defines advice to run after matched method execution value Method @After("execution(...)")
@Around Defines advice to run around matched method execution value Method @Around("execution(...)")
@Pointcut Declares reusable pointcut expression value Method @Pointcut("execution(...)")
📜 10. JAXB (XML Binding)
Parameter Where to
Annotation Purpose (including use) Example
s Use
@XmlRootEle
Specifies root XML element for class serialization name Class @XmlRootElement(name="user")
ment
name,
@XmlElement Maps field to XML element Field @XmlElement(name="id")
required
@XmlAttribu
Maps field to XML attribute name Field @XmlAttribute(name="type")
te
@XmlTransie
Excludes field from XML serialization — Field @XmlTransient
nt
@XmlAccesso Specifies field or property access for XML @XmlAccessorType(XmlAccessTyp
value Class
rType mapping e.FIELD)
🧬 12. Meta-Annotations (java.lang.annotation)
Annot Where to
Purpose (including use) Parameters Example
ation Use
@Targ Specifies valid program elements where annotation can value (ElementType Annotatio @Target(ElementType.M
et be applied values) n types ETHOD)
@Rete Specifies how long annotation information is retained value Annotatio @Retention(RetentionP
ntion (source/class/runtime) (RetentionPolicy) n types olicy.RUNTIME)
@Inhe Annotatio
Allows annotation to be inherited by subclasses — @Inherited
rited n types
@Docu
Annotatio
mente Includes annotation in generated Javadoc — @Documented
n types
d
@Repe
Allows multiple instances of the same annotation on a value (container Annotatio @Repeatable(Roles.cla
atabl
declaration annotation class) n types ss)
e
If you want, I can also export this as markdown or HTML formatted table for your use. Just ask!