Created
April 7, 2021 16:53
-
-
Save nemrosim/59d7b43a6d0b4eaacf5e8768ccdce48a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.nemrosim.services; | |
import com.nemrosim.models.User; | |
import com.nemrosim.repositories.UserRepository; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import java.util.List; | |
public class UserServiceImpl implements UserService { | |
private UserRepository repository; | |
public UserServiceImpl() { | |
System.out.println("UserServiceImpl default constructor"); | |
} | |
public UserServiceImpl(UserRepository repository) { | |
System.out.println("UserServiceImpl repository constructor"); | |
this.repository = repository; | |
} | |
@Override | |
public List<User> findAll() { | |
return repository.findAll(); | |
} | |
@Autowired | |
public void setRepository(UserRepository repository) { | |
System.out.println("UserServiceImpl setter"); | |
this.repository = repository; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment