spring data mongodb 操作保存时为什么一直出现com.mongodb.MongoException: couldn
代码如下 :
public GridFSFile upload(InputStream inputStream,String fileName,String fileType){
Assert.notNull(inputStream,"输入流不能为空!");
Assert.notNull(fileName,"文件不能为空!");
Assert.notNull(inputStream,"输入流不能为空!");
ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringMongoConfig.class);
gridOperations = (GridFsOperations) ctx.getBean("gridFsTemplate");
GridFSFile gridfs = gridOperations.store(inputStream, fileName,fileType);
return gridfs;
}