背景
在做
黑马点评
项目(为微服务项目)的时候,引入了Minio
,开始报错
报错:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildMinioClient' defined in class path resource [com/heima/file/config/MinIOConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.minio.MinioClient]: Factory method 'buildMinioClient' threw exception; nested exception is java.lang.IllegalArgumentException: endpoint must not be null.
at com.heima.es.EsInitApplication.main(EsInitApplication.java:16) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.minio.MinioClient]: Factory method 'buildMinioClient' threw exception; nested exception is java.lang.IllegalArgumentException: endpoint must not be null.
Caused by: java.lang.IllegalArgumentException: endpoint must not be null.
原因:
因为黑马将minio的服务抽取成了一个文件微服务,其他服务使用需要引用该文件微服务,我直接引用到了test这个父微服务下了,导致子微服务全部需要minio配置,产生了null
方法:
将test父微服务的pom文件中的文件微服务删了。如下代码删了
<dependency>
<groupId>com.heima</groupId>
<artifactId>heima-file-starter</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>