9 changed files with 113 additions and 24 deletions
@ -0,0 +1,33 @@ |
|||
package com.bnyer.file.config; |
|||
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.scheduling.annotation.EnableAsync; |
|||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
|||
|
|||
import java.util.concurrent.Executor; |
|||
import java.util.concurrent.ThreadPoolExecutor; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/10 15:31 |
|||
* @Description |
|||
*/ |
|||
@Configuration |
|||
@EnableAsync |
|||
public class ExecutorConfig { |
|||
|
|||
|
|||
@Bean |
|||
public Executor mySimpleAsync() { |
|||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
|||
executor.setCorePoolSize(10); |
|||
executor.setMaxPoolSize(50); |
|||
executor.setQueueCapacity(10); |
|||
executor.setThreadNamePrefix("fileUpload"); |
|||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); |
|||
executor.initialize(); |
|||
return executor; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.bnyer.file.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/10 16:37 |
|||
* @Description |
|||
*/ |
|||
@Getter |
|||
@Setter |
|||
@ApiModel("文件信息") |
|||
public class FileDto { |
|||
private byte[] bytes; |
|||
private String originalFilename; |
|||
private String name; |
|||
} |
|||
Loading…
Reference in new issue