We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
上传图片报错 Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.dromara.x.file.storage.core.FileStorageService.of(Ljava/lang/Object;)Lorg/dromara/x/file/storage/core/UploadPretreatment 代码: public FileInfo uploadImage(MultipartFile file,String imgPath,String type) { FileStorage fileStorage = fileStorageService.getFileStorage(); String path = StringUtils.isEmpty(imgPath)? "image/": imgPath+"/"+ DateUtils.datePath() + "/"; FileInfo fileInfo = fileStorageService.of(file) .setAcl(Constant.ACL.PRIVATE) .setOriginalFilename("a.jpg") .setObjectId("0") //关联对象类型,为了方便管理,不需要可以不写 .setObjectType(ImgTypeEnum.YHY_AI_COVER.name()) //保存一些属性,可以在切面、保存上传记录、自定义存储平台等地方获取使用,不需要可以不写 .putAttr("role", "admin") //使用指定的存储平台 .setPlatform("amazon-s3-1") .upload(); fileStorageService.setFileAcl(fileInfo, Constant.ACL.PUBLIC_READ); fileStorageService.setThFileAcl(fileInfo, Constant.ACL.PUBLIC_READ); return fileInfo; } 版本:2.1.0
The text was updated successfully, but these errors were encountered:
提示 NoSuchMethodError ,可能是第三方依赖冲突导致的,例如 AmazonS3 依赖的 okhttp 版本与已有的不兼容,你重新引入一个试试
Sorry, something went wrong.
降到2.0.0就可以了
No branches or pull requests
上传图片报错
Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: org.dromara.x.file.storage.core.FileStorageService.of(Ljava/lang/Object;)Lorg/dromara/x/file/storage/core/UploadPretreatment
代码:
public FileInfo uploadImage(MultipartFile file,String imgPath,String type) {
FileStorage fileStorage = fileStorageService.getFileStorage();
String path = StringUtils.isEmpty(imgPath)? "image/": imgPath+"/"+ DateUtils.datePath() + "/";
FileInfo fileInfo = fileStorageService.of(file)
.setAcl(Constant.ACL.PRIVATE)
.setOriginalFilename("a.jpg")
.setObjectId("0")
//关联对象类型,为了方便管理,不需要可以不写
.setObjectType(ImgTypeEnum.YHY_AI_COVER.name())
//保存一些属性,可以在切面、保存上传记录、自定义存储平台等地方获取使用,不需要可以不写
.putAttr("role", "admin")
//使用指定的存储平台
.setPlatform("amazon-s3-1")
.upload();
fileStorageService.setFileAcl(fileInfo, Constant.ACL.PUBLIC_READ);
fileStorageService.setThFileAcl(fileInfo, Constant.ACL.PUBLIC_READ);
return fileInfo;
}
版本:2.1.0
The text was updated successfully, but these errors were encountered: