Code:
@NoRepositoryBean
public interface AbstractRepository <M extends AbstractModel> extends MongoRepository<M, String> {
Page<M> findAll(Pageable pageable);
Page<M> findAllByIsActive(boolean isActive, Pageable pageable);
}
And are other warning in findAll parameter:
Missing non-null annotation: inherited method from PagingAndSortingRepository<M,String> specifies this parameter as @NonNullJava(67109781)
whats wrong?
The MongoRepository
interface extends from PagingAndSortingRepository
which defines a method signature with a @NonNull
annotation for the Pageable
parameter. The warning suggests adding @NonNull
to your signature to maintain the contract, although this is optional.
import org.springframework.data.annotation.NonNull;
@NoRepositoryBean
public interface AbstractRepository <M extends AbstractModel> extends MongoRepository<M, String> {
Page<M> findAll(@NonNull Pageable pageable);
Page<M> findAllByIsActive(boolean isActive, @NonNull Pageable pageable);
}