BookServiceSpring.java 662 Bytes
package org.legrog.web.book;


import org.legrog.entities.Book;
import org.legrog.entities.BookRepository;
import org.legrog.web.book.BookService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ejb.Stateless;
import javax.inject.Inject;
import java.util.List;


@Stateless
public class BookServiceSpring implements BookService {

    Logger logger = LoggerFactory.getLogger(getClass());

    @Inject
    BookRepository bookRepository;

    public void addBook(Book book) {
        logger.debug("spring one");
        bookRepository.save(book);
    }

    public List<Book> getAllBooks() {
        return bookRepository.findAll();
    }
}