source: src/main/java/com/example/autopartz/service/impl/PartServiceImpl.java@ ae042f4

main
Last change on this file since ae042f4 was ae042f4, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 18 months ago

Configured spring security, changed spring version

  • Property mode set to 100644
File size: 726 bytes
Line 
1package com.example.autopartz.service.impl;
2
3import com.example.autopartz.model.Part;
4import com.example.autopartz.repository.PartRepository;
5import com.example.autopartz.service.PartService;
6import org.springframework.stereotype.Service;
7
8import java.util.List;
9
10@Service
11public class PartServiceImpl implements PartService {
12 private final PartRepository partRepository;
13
14 public PartServiceImpl(PartRepository partRepository) {
15 this.partRepository = partRepository;
16 }
17
18 @Override
19 public List<Part> findAll() {
20 return partRepository.findAll();
21 }
22
23 @Override
24 public Part findById(Integer id) {
25 return partRepository.findById(id).orElseThrow(RuntimeException::new);
26 }
27}
Note: See TracBrowser for help on using the repository browser.