diff options
| author | Szymon Szukalski <szymon@skas.io> | 2024-07-25 20:54:41 +1000 |
|---|---|---|
| committer | Szymon Szukalski <szymon@skas.io> | 2024-07-25 20:54:41 +1000 |
| commit | cf4edfcb4bc7d0d02cefa861a95812315f092a66 (patch) | |
| tree | 5a3996a51a7ced388a6d7f4fa5c0d2a84124010e /src/main/java/com/stileeducation/markr/service/StudentService.java | |
| parent | aa9bdd514ab90d0da0391b879255a22c29450e9a (diff) | |
Removed unused variables and switch to constructor injection
Diffstat (limited to 'src/main/java/com/stileeducation/markr/service/StudentService.java')
| -rw-r--r-- | src/main/java/com/stileeducation/markr/service/StudentService.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/stileeducation/markr/service/StudentService.java b/src/main/java/com/stileeducation/markr/service/StudentService.java index 3ce28c0..95ce182 100644 --- a/src/main/java/com/stileeducation/markr/service/StudentService.java +++ b/src/main/java/com/stileeducation/markr/service/StudentService.java @@ -2,7 +2,6 @@ package com.stileeducation.markr.service; import com.stileeducation.markr.entity.Student; import com.stileeducation.markr.repository.StudentRepository; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Optional; @@ -10,8 +9,11 @@ import java.util.Optional; @Service public class StudentService { - @Autowired - private StudentRepository studentRepository; + private final StudentRepository studentRepository; + + public StudentService(StudentRepository studentRepository) { + this.studentRepository = studentRepository; + } public Student findOrCreateStudent(String firstName, String lastName, String studentNumber) { Optional<Student> optionalStudent = studentRepository.findByStudentNumber(studentNumber); |
