At present, many friends have mentioned the upgrade problem of MINIO version. Here is the modification method:
Depend on the change
<dependency> <groupId> IO. Minio </groupId> </artifactId> minio</artifactId> <version>8.0.3</version> </dependency>
Class to add the following import content
import io.minio.*;
The main issues are as follows:
1. The MinioClient constructor is now retrieved from Builder
MiniOClient miniOClient = new miniOClient (miniOurl, minioName, miniOPass);
Endpoint (minioUrl).Credentials (minioName, minioPass).build();
2. Check the presence of buckets
Boolean isExist = minioclient. bucketExists(bucketName);
Boolean isExist = minioclient.bucketexists (bucketexistsargs.builder ().bucket(bucketName).build().
3. How to create buckets
Before Modified: minioclient. makeBucket(newBucket);
MakeBucket (makeBucket Args.builder().bucket(newBucket).build());
4. File upload method
MiniOClient.putObject (newBucket,objectName, stream,stream.available(),"application/octet-stream");
Revised: PutObjectArgs objectArgs = PutObjectArgs.builder().object(objectName) .bucket(newBucket) .contentType("application/octet-stream") .stream(stream,stream.available(),-1).build(); minioClient.putObject(objectArgs);
5. Get the file stream
InputStream = miniOclient.GetObject (bucketName, objectName);
GetObjectArgs ObjectArgs = GetObjectArgs.Builder ().Object (ObjectName).Bucket (bucketName).Build (); inputStream = minioClient.getObject(objectArgs);
6. Delete files
MiniOclient. removeObject(bucketName, objectName);
RemoveObjectArgs ObjectArgs = removeObjectArgs. Builder ().object(objectName).bucket(bucketName).build(); removeObjectArgs = removeObjectArgs. minioClient.removeObject(objectArgs);
If there is a small friend who also meets the same problem and has modified other relevant places, you can contact my younger brother to study and discuss together