Junior — Middle
What Spring-based projects have you implemented and what was the most significant in them?
sobes.tech AI
Answer from AI
In one of my projects based on Spring, I implemented a REST API for managing orders in an online store. The most significant aspects were using Spring Boot for quick application startup and Spring Data JPA for convenient database interaction. It was also important to implement Spring Security for user authentication and authorization.
Example of a controller in Spring Boot:
@RestController
@RequestMapping("/orders")
public class OrderController {
private final OrderService orderService;
public OrderController(OrderService orderService) {
this.orderService = orderService;
}
@GetMapping("/{id}")
public ResponseEntity<Order> getOrder(@PathVariable Long id) {
return ResponseEntity.of(orderService.findById(id));
}
@PostMapping
public ResponseEntity<Order> createOrder(@RequestBody Order order) {
Order savedOrder = orderService.save(order);
return ResponseEntity.status(HttpStatus.CREATED).body(savedOrder);
}
}