findById

Service

public DepartmentDTO findById(UUID id) {
    Department department = departmentRepository.findById(id)
            .orElseThrow(() -> new ResourceNotFoundException("Department not found"));

    return new DepartmentDTO(department);
}

Controller

@GetMapping(value = "/{id}")
public ResponseEntity<DepartmentDTO> findById(@PathVariable UUID id) {
    DepartmentDTO dto = departmentService.findById(id);
    return ResponseEntity.ok().body(dto);
}

Atualizado