Quick reference for REST, DI, and data annotations
Concise showcase of essential Spring Boot annotations. Configure REST endpoints, dependency injection, and data handling effectively.
| Category | Annotations |
|---|---|
| Core | @SpringBootApplication, @Component, @Bean |
| REST | @RestController, @GetMapping, @PostMapping |
| DI | @Autowired, @Qualifier, @Value |
| Data | @Entity, @Repository, @Transactional |
| Config | @Configuration, @PropertySource |
@RestController
@RequestMapping("/api")
public class UserController {
@Autowired
private UserService userService;
@GetMapping("/users")
public List<User> getAll() {
return userService.findAll();
}
@PostMapping("/users")
public User create(@RequestBody User user) {
return userService.save(user);
}
}Spring Boot | REST API | JPA | Maven
Keywords: Spring-Boot Annotations REST-API Autowired Component Controller Repository