Springboot Flashcards
(16 cards)
What are annotations used for in Springboot?
Annotations in Spring Boot are used to provide metadata for the Java code, enabling a simpler and more readable configuration compared to XML-based configurations. They play a crucial role in the framework, driving various functionalities and configurations.
What does the @Autowired annotation do?
It is used for dependency injection, allowing Spring to resolve and inject collaborating beans into your bean.
What annotations are used for dependency injection?
@Autowired, @Qualifier, and @Bean
What annotations are used for Component Scanning?
@Component, @Service, @Repository, and @Controller are used to automatically detect and register beans in the Spring container from the classpath scanning.
What annotations are used for configuration?
Configuration: @Configuration is used in classes that define beans. @PropertySource is used to declare a set of properties (defined in a file) in a Spring environment.
What annotations are used for web development?
Web Development: Annotations like @RequestMapping (and its variant annotations like @GetMapping, @PostMapping, etc.), @ResponseBody, @RestController, and @PathVariable are heavily used in Spring MVC for handling web requests.
What annotations are used for Aspect, Oriented (AOP) Programming
Aspect-Oriented Programming (AOP): @Aspect, @Before, @After, @Around, etc., are used for aspect-oriented programming which allows implementing cross-cutting concerns.
- @Aspect
- @Before
- @After
- @Around
What annotations are used for transitional management?
Transaction Management: @Transactional is used for declarative transaction management.
What annotations are Springboot specific?
Spring Boot-Specific Features: Annotations like @SpringBootApplication, @EnableAutoConfiguration, and @SpringBootConfiguration are specific to Spring Boot and help with auto-configuration, component scanning, and configuration setup.
- @SpringBootApplication
- @EnableAutoConfiguration
- @SpringBootConfiguration
What annotations are used in testing?
Testing: @SpringBootTest, @DataJpaTest, @WebMvcTest, etc., are used to simplify the setup and configuration of tests.
What annotations are used in security?
Security: Annotations like @PreAuthorize, @PostAuthorize, @Secured, etc., are used for method-level security.
What invitations are used in data access?
Data Access: @Entity, @Table, @Id, etc., are used in Spring Data JPA for ORM (Object-Relational Mapping) and database operations.
What annotations are used in validation?
Validation: Annotations such as @Valid, @NotNull, @Size, etc., are used for validating Java beans.
What annotations are used in caching?
Caching: @EnableCaching, @Cacheable, @CacheEvict, etc., are used for caching abstractions.
What annotations are used in scheduled tasks?
Scheduled Tasks: @Scheduled is used to define methods that should run at a fixed interval or cron expression.
What annotations are used in event handling?
Event Handling: Annotations like @EventListener are used to mark methods as event listeners.