Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractTransactionalTest with mongodb fails with No qualifying bean error #256

Open
nitinsurana opened this issue Jun 15, 2015 · 4 comments

Comments

@nitinsurana
Copy link

@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: {}
@nitinsurana nitinsurana changed the title AbstractTransactionalTest with mongodb fails with AbstractTransactionalTest with mongodb fails with No qualifying bean error Jun 15, 2015
@bcecchinato
Copy link
Contributor

Didn't you forgot the profile "resthub-jpa" ?

@nitinsurana
Copy link
Author

I'm using mongodb, isn't that supposed to be in resthub-mongodb which I've already added to the test.

@bcecchinato
Copy link
Contributor

Reading briefly the resthubContext.xml in mongodb, no datasource bean is defined. It is in the hikariCp or boneCp profiles. I've never used mongo so I don't really know how datasource are working with it :(

@nitinsurana
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants