I am trying to create a simple service file in spring, I am completely beginner in Java and therefore do not understand why I am getting an error message while on a given example it works fine.
Here's an error message:
Error:(24, 35) java: non-static method save(S) cannot be referenced from a static context
@Service
public class UserService {
@Autowired
protected static UserEntryRepository userEntryRepository;
public static List<UserEntry> findAll() {
return userEntryRepository.findAll();
}
public static UserEntry save(UserEntry entry) {
return UserEntryRepository.save(entry);
}
}
It seems there is a problem with .save but I do not understand why, if any more code is required please let me know ;)