Skip to content
Snippets Groups Projects

M2 certificate response entity

Merged Ester Vilímková requested to merge M2-certificate-responseEntity into M2
Files
2
@@ -4,8 +4,10 @@ import org.fuseri.modulecertificate.Certificate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
import java.util.List;
@@ -22,7 +24,7 @@ public class CertificateService {
@Transactional(readOnly = true)
public Certificate findById(Long id) {
return certificateRepository.findById(id)
.orElseThrow(() -> new ResourceNotFoundException("Certificate with id: " + id + " was not found."));
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Certificate with id: " + id + " was not found."));
}
@Transactional(readOnly = true)
Loading