增加@RefreshScope注解,实现配置、实例热加载
This commit is contained in:
parent
f0f2cde0f9
commit
2050a216b0
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.file.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import io.minio.MinioClient;
|
||||
|
|
@ -10,6 +11,7 @@ import io.minio.MinioClient;
|
|||
*
|
||||
* @author ruoiy
|
||||
*/
|
||||
@RefreshScope
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "minio")
|
||||
public class MinioConfig
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RefreshScope
|
||||
@Configuration
|
||||
public class ResourcesConfig implements WebMvcConfigurer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.file.service;
|
|||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
|
||||
|
|
@ -13,6 +14,7 @@ import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RefreshScope
|
||||
@Service
|
||||
public class FastDfsSysFileServiceImpl implements ISysFileService
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.file.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -11,6 +12,7 @@ import com.ruoyi.file.utils.FileUploadUtils;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RefreshScope
|
||||
@Primary
|
||||
@Service
|
||||
public class LocalSysFileServiceImpl implements ISysFileService
|
||||
|
|
@ -40,6 +42,7 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|||
* @return 访问地址
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
String name = FileUploadUtils.upload(localFilePath, file);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.file.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.file.config.MinioConfig;
|
||||
|
|
@ -13,6 +14,7 @@ import io.minio.PutObjectArgs;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RefreshScope
|
||||
@Service
|
||||
public class MinioSysFileServiceImpl implements ISysFileService
|
||||
{
|
||||
|
|
@ -29,6 +31,7 @@ public class MinioSysFileServiceImpl implements ISysFileService
|
|||
* @return 访问地址
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
String fileName = FileUploadUtils.extractFilename(file);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.core.exception.file.FileNameLengthLimitExceededException;
|
||||
import com.ruoyi.common.core.exception.file.FileSizeLimitExceededException;
|
||||
|
|
@ -18,6 +19,7 @@ import com.ruoyi.common.core.utils.file.MimeTypeUtils;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RefreshScope
|
||||
public class FileUploadUtils
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue