-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
333 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...src/main/java/com/jmsoftware/maf/springcloudstarter/configuration/MinioConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.jmsoftware.maf.springcloudstarter.configuration; | ||
|
||
import com.jmsoftware.maf.springcloudstarter.helper.MinioHelper; | ||
import io.minio.MinioClient; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
|
||
/** | ||
* <h1>MinioConfiguration</h1> | ||
* <p> | ||
* Change description here. | ||
* | ||
* @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 6/7/21 9:58 PM | ||
**/ | ||
@Slf4j | ||
@Configuration | ||
@Import({ | ||
MinioProperty.class | ||
}) | ||
public class MinioConfiguration { | ||
@Bean | ||
public MinioClient minioClient(MinioProperty minioProperty) { | ||
log.warn("Initial bean: '{}'", MinioClient.class.getSimpleName()); | ||
return MinioClient.builder() | ||
.endpoint(minioProperty.getEndpoint(), minioProperty.getPort(), | ||
minioProperty.getSecure()) | ||
.credentials(minioProperty.getAccessKey(), minioProperty.getSecretKey()) | ||
.build(); | ||
} | ||
|
||
@Bean | ||
public MinioHelper minioHelper(MinioClient minioClient) { | ||
log.warn("Initial bean: '{}'", MinioHelper.class.getSimpleName()); | ||
return new MinioHelper(minioClient); | ||
} | ||
} |
41 changes: 30 additions & 11 deletions
41
...nfiguration/MinioClientConfiguration.java → ...dstarter/configuration/MinioProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,57 @@ | ||
package com.jmsoftware.maf.springcloudstarter.configuration; | ||
|
||
import lombok.Data; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* <h1>MinioConfiguration</h1> | ||
* <h1>MinioProperty</h1> | ||
* <p> | ||
* Change description here. | ||
* | ||
* @author Johnny Miller (鍾俊), email: johnnysviva@outlook.com | ||
* @date 4/29/21 2:23 PM | ||
**/ | ||
* @author Johnny Miller (锺俊), email: johnnysviva@outlook.com, date: 6/7/21 9:39 PM | ||
*/ | ||
@Data | ||
@Slf4j | ||
@Validated | ||
@Component | ||
@ConfigurationProperties(prefix = MinioClientConfiguration.PREFIX) | ||
public class MinioClientConfiguration { | ||
public static final String PREFIX = "minio.client.configuration"; | ||
@ConfigurationProperties(prefix = MinioProperty.PREFIX) | ||
public class MinioProperty { | ||
/** | ||
* The constant PREFIX. | ||
*/ | ||
public static final String PREFIX = "minio"; | ||
/** | ||
* The Endpoint. | ||
*/ | ||
@NotBlank | ||
private String endpoint; | ||
/** | ||
* The Port. | ||
*/ | ||
@NotNull | ||
private Integer port; | ||
/** | ||
* The Access key. User ID | ||
*/ | ||
@NotBlank | ||
private String accessKey; | ||
/** | ||
* The Secret key. Password | ||
*/ | ||
@NotBlank | ||
private String secretKey; | ||
/** | ||
* The Secure. | ||
*/ | ||
private Boolean secure = Boolean.TRUE; | ||
/** | ||
* The Bucket name. | ||
*/ | ||
private String bucketName; | ||
/** | ||
* The Config dir. | ||
*/ | ||
private String configDir; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.