In order to spring to create bean and inject it class should be marked with @Componet,@service,@Repository etc in your context it should be
package main.java.service;
import java.util.List;
import main.java.model.User;
import org.springframework.data.mongodb.repository.MongoRepository;
@Repository
public interface UserService extends MongoRepository<User, String> {
public List<User> findAll();
}