daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Dec 17th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand