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

Loading…
Cancel
Save