Here's a comprehensive list of annotations commonly used in the repository layer of Spring Boot applications:
Core Repository Annotations
@Repository
Marks a class as a Spring Data repository
Specialized form of @Component for persistence layer
Enables exception translation from persistence technology-specific exceptions to Spring's DataAccessException hierarchy
@RepositoryRestResource (Spring Data REST)
Exposes a repository as a RESTful resource
Customizes path and collection resource rel
Spring Data JPA Annotations
@Entity
Marks a class as a JPA entity (persistent domain object)
@Table
Specifies the primary table for the annotated entity
@Id
Specifies the primary key of an entity
@GeneratedValue
Provides specification of generation strategies for primary keys
@Column
Specifies the mapped column for a persistent property or field
@OneToMany, @ManyToOne, @OneToOne, @ManyToMany
Define entity relationships
@JoinColumn
Specifies a column for joining an entity association
@Embedded and @Embeddable
For embeddable classes (value types)
Query Method Annotations
@Query
Defines a custom query directly on repository methods
Can use JPQL or native SQL
@Modifying
Indicates a query method should be considered as modifying query
@Param
Binds method parameters to query parameters
Transaction Management
@Transactional
Defines transaction boundaries at the repository layer
Typically used at service layer but can be used in repositories
Auditing Annotations
@CreatedDate, @LastModifiedDate
Automatically track when entities are created/modified
@CreatedBy, @LastModifiedBy
Track who created/modified entities
Special Purpose Annotations
@NoRepositoryBean
Used on repository interfaces to indicate they shouldn't be instantiated
@EnableJpaRepositories
Configures the base packages for repository interfaces (typically in main app class)
@EntityScan
Configures base packages for entity classes
@NamedQuery and @NamedNativeQuery
Define named queries on entity classes
Spring Data Specific
@DomainEvents and @AfterDomainEventPublication
For publishing domain events from aggregate roots
@Lock
Specifies the lock mode for a query method
@Async
Makes repository methods execute asynchronously
These annotations help define the data access layer in Spring Boot applications, particularly when using Spring Data JPA. The exact annotations you'll use depend on your specific persistence technology (JPA, MongoDB, etc.) and requirements.