Guest User

Untitled

a guest
Dec 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. package com.example.services;
  2.  
  3. import javax.transaction.Transactional;
  4.  
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Service;
  7.  
  8. import com.example.modal.User;
  9. import com.example.repository.userRepository;
  10.  
  11.  
  12. @Service
  13. @Transactional
  14. public class UserService {
  15.  
  16. @Autowired
  17. private userRepository userRepository;
  18.  
  19.  
  20. public UserService() {
  21. super();
  22. }
  23.  
  24. public UserService(userRepository userRepository)
  25. {
  26. this.userRepository = userRepository;
  27. }
  28.  
  29. public void saveMyuser(User user) {
  30. userRepository.save(user);
  31. }
  32. }
  33.  
  34. package com.example.repository;
  35.  
  36. import org.springframework.data.repository.CrudRepository;
  37. import org.springframework.stereotype.Repository;
  38.  
  39.  
  40. import com.example.modal.User;
  41.  
  42.  
  43. public interface userRepository extends CrudRepository<User,Integer> {
  44.  
  45. }
  46.  
  47. @Repository
  48. public interface userRepository extends CrudRepository<User,Integer> {
  49.  
  50. }
Add Comment
Please, Sign In to add comment