Browse Source

Change autowired

main
Jesus 2 years ago
parent
commit
7576d96c9f
2 changed files with 7 additions and 7 deletions
  1. +3
    -3
      src/main/java/com/jesuspinar/booksearch/service/BookQueryService.java
  2. +4
    -4
      src/main/java/com/jesuspinar/booksearch/service/BookService.java

+ 3
- 3
src/main/java/com/jesuspinar/booksearch/service/BookQueryService.java View File

@ -1,6 +1,6 @@
package com.jesuspinar.booksearch.service;
import com.jesuspinar.booksearch.dao.BookDao;
import com.jesuspinar.booksearch.dao.IBookDao;
import com.jesuspinar.booksearch.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -15,7 +15,7 @@ import java.util.stream.Collectors;
public class BookQueryService implements IBookQueryService{
@Autowired
BookDao dao;
IBookDao iBookDao;
private Predicate<Book> predicate;
@ -26,7 +26,7 @@ public class BookQueryService implements IBookQueryService{
@Override
public Collection<Book> exec() {
return dao.findAll()
return iBookDao.findAll()
.stream()
.filter(predicate)
.collect(Collectors.toList());


+ 4
- 4
src/main/java/com/jesuspinar/booksearch/service/BookService.java View File

@ -1,6 +1,6 @@
package com.jesuspinar.booksearch.service;
import com.jesuspinar.booksearch.dao.BookDao;
import com.jesuspinar.booksearch.dao.IBookDao;
import com.jesuspinar.booksearch.model.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -14,7 +14,7 @@ import java.util.stream.Collectors;
public class BookService implements IBookService{
@Autowired
BookDao bookDao;
IBookDao iBookDao;
@Autowired
IBookQueryService queryService;
@ -24,7 +24,7 @@ public class BookService implements IBookService{
public Collection<String> findAllGenres() {
List<String> result = null;
result = bookDao.findAll()
result = iBookDao.findAll()
.stream()
.map(book -> book.getGenre())
//.flatMap(l -> Stream.of(l))//TODO: Check this if other java version!
@ -52,6 +52,6 @@ public class BookService implements IBookService{
@Override
public Collection<Book> findAll() {
return bookDao.findAll();
return iBookDao.findAll();
}
}

Loading…
Cancel
Save