配置类的报错:
Could not autowire. No beans of 'MongoClient' type found.
这是 MongoDB 的配置类(JavaConfig)
- package com.xuecheng.manage_cms.config;
-
- import com.mongodb.client.MongoClient;
- import com.mongodb.client.MongoDatabase;
- import com.mongodb.client.gridfs.GridFSBucket;
- import com.mongodb.client.gridfs.GridFSBuckets;
-
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
-
- /**
- * Created by 16114 on 2019/6/8.
- */
- @Configuration
- public class MongoConfig {
- @Value("${spring.data.mongodb.database}")
- String db;
-
- @Bean
- public GridFSBucket getGridFSBucket(MongoClient mongoClient){ //Could not autowire. No beans of 'MongoClient' type found.
- MongoDatabase database = mongoClient.getDatabase(db);
- GridFSBucket bucket = GridFSBuckets.create(database);
- return bucket;
- }
- }
这是测试类
- package com.xuecheng.manage_cms;
-
- import com.mongodb.client.gridfs.GridFSBucket;
- import com.mongodb.client.gridfs.GridFSDownloadStream;
- import com.mongodb.client.gridfs.model.GridFSFile;
-
- import org.apache.commons.io.IOUtils;
- import org.bson.types.ObjectId;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.test.context.SpringBootTest;
- import org.springframework.data.mongodb.core.query.Criteria;
- import org.springframework.data.mongodb.core.query.Query;
- import org.springframework.data.mongodb.gridfs.GridFsResource;
- import org.springframework.data.mongodb.gridfs.GridFsTemplate;
- import org.springframework.test.context.junit4.SpringRunner;
-
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
-
- /**
- * Created by 16114 on 2019/6/7.
- */
- @SpringBootTest
- @RunWith(SpringRunner.class)
- public class GridFsTest {
-
- @Autowired
- GridFsTemplate gridFsTemplate;
-
- @Autowired
- GridFSBucket gridFSBucket;
-
- @Test
- public void testGridFsTemplate() throws FileNotFoundException {
- File file = new File("d:/index_banner.ftl");
- FileInputStream fileInputStream = new FileInputStream(file);
- ObjectId objectId = gridFsTemplate.store(fileInputStream, "index_banner.ftl");
- System.out.println(objectId);
- }
-
- @Test
- public void queryFile() throws IOException {
- String fileId = "5cfb2520fd9fe107c887ee61";
- //根据id查询文件
- GridFSFile gridFSFile =
- gridFsTemplate.findOne(Query.query(Criteria.where("_id").is(fileId)));
- //打开下载流对象
- GridFSDownloadStream gridFSDownloadStream =
- gridFSBucket.openDownloadStream(gridFSFile.getObjectId());
- //创建gridFsResource,用于获取流对象
- GridFsResource gridFsResource = new GridFsResource(gridFSFile,gridFSDownloadStream);
- //获取流中的数据
- String s = IOUtils.toString(gridFsResource.getInputStream(), "UTF-8");
- System.out.println(s);
- }
-
- //删除文件
- @Test
- public void testDelFile() throws IOException {
- //根据文件id删除fs.files和fs.chunks中的记录
- gridFsTemplate.delete(Query.query(Criteria.where("_id").is("5cfb2520fd9fe107c887ee61")));
- }
-
- }
运行测试类的报错信息
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.mongodb.client.MongoClient' available: expected at least 1 bean which qualifies as autowire
-
- Exclusions:
- -----------
-
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
-
-
- Unconditional classes:
- ----------------------
-
- org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
-
- org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
-
- org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
-
-
-
- 2019-06-08 12:34:46.275 [main] DEBUG o.s.b.d.LoggingFailureAnalysisReporter - Application failed to start due to an exception
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.mongodb.client.MongoClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1655)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1214)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1168)
- at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
- at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
- at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
- at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
- at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
- at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:843)
- at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
- at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
- at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
- at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
- at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
- at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
- at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
- at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
- at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
- at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
- at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
- at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
- at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
- at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
- at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
- at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
- at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
- at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
- at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
- at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
- at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
- at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
- at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
- 2019-06-08 12:34:46.278 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter -
-
- ***************************
- APPLICATION FAILED TO START
- ***************************
-
- Description:
-
- Parameter 0 of method getGridFSBucket in com.xuecheng.manage_cms.config.MongoConfig required a bean of type 'com.mongodb.client.MongoClient' that could not be found.
-
-
- Action:
-
- Consider defining a bean of type 'com.mongodb.client.MongoClient' in your configuration.
-
- 2019-06-08 12:34:46.281 [main] ERROR o.s.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@9597028] to prepare test instance [com.xuecheng.manage_cms.GridFsTest@6af5b246]
- java.lang.IllegalStateException: Failed to load ApplicationContext
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
- at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
- at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
- at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
- at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
- at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
- at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
- at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
- at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
- at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
- at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
- at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
- at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
- at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
- at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
- at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
- at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
- at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
- Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'getGridFSBucket' defined in class path resource [com/xuecheng/manage_cms/config/MongoConfig.class]: Unsatisfied dependency expressed through method 'getGridFSBucket' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.mongodb.client.MongoClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
- at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769)
- at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
- at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
- at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
- at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:843)
- at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
- at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
- at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
- at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
- at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
- at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
- ... 28 common frames omitted
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.mongodb.client.MongoClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1655)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1214)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1168)
- at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
- at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
- ... 46 common frames omitted
- java.lang.IllegalStateException: Failed to load ApplicationContext
-
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
- at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
- at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
- at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
- at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
- at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
- at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
- at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
- at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
- at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
- at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
- at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
- at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
- at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
- at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
- at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
- at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
- at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
- at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
- Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'getGridFSBucket' defined in class path resource [com/xuecheng/manage_cms/config/MongoConfig.class]: Unsatisfied dependency expressed through method 'getGridFSBucket' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.mongodb.client.MongoClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
- at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769)
- at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
- at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
- at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
- at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:843)
- at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
- at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
- at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
- at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
- at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
- at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
- at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
- ... 28 more
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.mongodb.client.MongoClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1655)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1214)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1168)
- at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
- at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
- ... 46 more
-
-
- Process finished with exit code -1