Skip to content

AbstractTransactionalTest with mongodb fails with No qualifying bean error #256

@nitinsurana

Description

@nitinsurana
@ActiveProfiles({"resthub-mongodb"})
public class TestVideoExistsInMongo extends AbstractTransactionalTest {

    @Inject
    VideoRepository videoRepository;

    @Test
    public void videoExists() {
        String videoId = "3u1fu6f8Hto";
        Integer size = videoRepository.findByVideoId(videoId, new PageRequest(0, 1)).size();
        System.out.println("Found : " + size);
    }
}

As per the documentation (http://resthub.org/docs/spring/testing/) the above code should work, but instead throws


19:49:20 [main] ERROR o.s.t.c.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@15f9a2a4] to prepare test instance [com.nitinsurana.TestVideoExistsInMongo@17073812]
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.sql.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions