Relative Content

Tag Archive for mongodbspring-boot

Switch mongo template on run time, spring boot

I’m using spring-data-mongodb. I want to connect to 2 mongodb instance, have created 2 mongo clients and 2 mongo template successfully.
I wonder if can implement mongoTemplateRef inside EnableMongoRepositories to dynamically switch between 2 db?
@EnableMongoRepositories(value = "com.example.web.repository")

required a bean of type ‘com.supriya.banking.repository.AccountRepository’ that could not be found

APPLICATION FAILED TO START Description: Field accountRepository in com.supriya.banking.service.AccountService required a bean of type ‘com.supriya.banking.repository.AccountRepository’ that could not be found. The injection point has the following annotations: – @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type ‘com.supriya.banking.repository.AccountRepository’ in your configuration. Why is it asking for bean creation, shouldn’t it create on its own? build.gradle plugins […]