I have a spring-boot application with mongodb. I'm trying to add paging search capability. But a error happens:
Parameter 1 of constructor in com.life.library.adapter.port.out.mongo.MongoPortImpl required a bean of type 'com.life.library.adapter.port.out.mongo.repository.BookRepository' that could not be found.
Action:
Consider defining a bean of type 'com.life.library.adapter.port.out.mongo.repository.BookRepository' in your configuration.
My repositories:
public interface BookSearchRepository {
Page<BookDocument> search();
}
@Repository
public interface BookRepository
extends PagingAndSortingRepository<BookDocument, String>, BookSearchRepository {
}
Implementation of BookSearchRepository repository:
@Component
@RequiredArgsConstructor
public class BookSearchRepositoryImpl implements BookSearchRepository {
private final MongoTemplate mongoTemplate;
@Override
public Page<BookDocument> search(){
...
}
}
Class, where I am trying to make autowaring of BookRepository:
@Component
@RequiredArgsConstructor
public class MongoPortImpl implements CreatePort, GetPort, SavePort {
private final BookRepository bookRepository;
}