Advertisement
dekikurnia

Untitled

Jul 10th, 2017
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package com.dekikurnia.services;
  2.  
  3. import com.dekikurnia.entities.Product;
  4. import com.dekikurnia.repositories.ProductRepository;
  5. import java.util.List;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Service;
  8.  
  9. /**
  10.  *
  11.  * @author dekikurnia
  12.  */
  13. @Service("productService")
  14. public class ProductServiceImpl implements ProductService{
  15.    
  16.     private ProductRepository productRepository;
  17.  
  18.     @Autowired
  19.     public void setProductRepository(ProductRepository productRepository) {
  20.         this.productRepository = productRepository;
  21.     }
  22.  
  23.     @Override
  24.     public Iterable <Product> getAllProducts() {
  25.         return productRepository.findAll();
  26.     }
  27.  
  28.     @Override
  29.     public Product getProductById(Integer id) {
  30.         return productRepository.findOne(id);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement