BookServiceSpring.java 669 Bytes
package org.legrog.application;


import org.legrog.entities.Book;
import org.legrog.entities.BookRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ejb.Stateless;
import javax.enterprise.inject.Alternative;
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();
    }
}