Use constructor injection
@Service
public class StudentService {
private final StudentRepository repo;
public StudentService(StudentRepository repo) {
this.repo = repo;
}
Or annotate setter for repo
variable with @Autowired
(but still constructor injection is preferred)
Same goes for your other class that has next1
method where you are trying to call StudentService
More on topic:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…