Curated list of frequently used annotations in Spring Boot applications
This document contains non-comprehensive list of frequently used annotations in Spring Boot applications. It should rather be used as a quick lookup list, for detailed and comprehensive information please read official javadocs and documentation.
@Controller
bean and adds @ResponseBody
to serialize returned results as messagesSQLException
to DataAccessExceptions
@Configuration
applicaiton.properties
file to add key-value pairs to Spring Environment
@Compenent
, @Service
, etc.@Valid
that allows validation of multiple groups, e.g. all fields of an annotated class@Configuration
@ConfigurationProperties
classes@SpringBootConfiguration
, @EnableAutoConfiguration
, @ConfigurationPropertiesScan
and @ComponentScan
@Configuration
to load application context for integration test@ContextConfiguration
and @ExtendWith(SpringExtension.class)
@Transactional
EntityManger
is injected into annotated setters and fieldsEmbeddable
class@ManyToOne
or @OneToOne
relationships at the owning side or unidirectional @OneToMany
@ManyToOne
or @OneToOne
relationships to be the primary key of referencing and referenced entities@Aspect