Last change
on this file since 2269653 was ac25203, checked in by DenicaKj <dkorvezir@…>, 22 months ago |
Spring Security
|
-
Property mode
set to
100644
|
File size:
935 bytes
|
Line | |
---|
1 | package com.example.moviezone.service.Impl;
|
---|
2 |
|
---|
3 | import com.example.moviezone.model.User;
|
---|
4 | import com.example.moviezone.model.exceptions.UserNotFoundException;
|
---|
5 | import com.example.moviezone.repository.UserRepository;
|
---|
6 | import com.example.moviezone.service.UserService;
|
---|
7 | import org.springframework.stereotype.Service;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | public class UserServiceImpl implements UserService {
|
---|
13 |
|
---|
14 | private final UserRepository userRepository;
|
---|
15 |
|
---|
16 | public UserServiceImpl(UserRepository userRepository) {
|
---|
17 | this.userRepository = userRepository;
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public List<User> findAllUsers() {
|
---|
22 | return userRepository.findAll();
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public User findById(Integer id) {
|
---|
27 | return userRepository.findById(id).orElseThrow(UserNotFoundException::new);
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public User findByUsername(String username) {
|
---|
32 | return userRepository.findByUsername(username);
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.