We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7864328 commit 198db37Copy full SHA for 198db37
src/main/java/com/back/domain/user/service/UserService.java
@@ -0,0 +1,20 @@
1
+package com.back.domain.user.service;
2
+
3
+import com.back.domain.user.entity.User;
4
+import com.back.domain.user.repository.UserRepository;
5
+import lombok.RequiredArgsConstructor;
6
+import org.springframework.stereotype.Service;
7
+import org.springframework.transaction.annotation.Transactional;
8
9
+@Service
10
+@RequiredArgsConstructor
11
+public class UserService {
12
13
+ private final UserRepository userRepository;
14
15
+ @Transactional(readOnly = true)
16
+ public User findById(Long id) {
17
+ return userRepository.findById(id)
18
+ .orElseThrow(() -> new IllegalArgumentException("User not found. id=" + id));
19
+ }
20
+}
0 commit comments