parent
6b9a65b842
commit
fe073568e1
@ -0,0 +1,23 @@
|
|||||||
|
package com.sky.config;
|
||||||
|
|
||||||
|
import com.sky.properties.AliOssProperties;
|
||||||
|
import com.sky.utils.AliOssUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Slf4j
|
||||||
|
public class OssConfiguration {
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public AliOssUtil aliOssUtil(AliOssProperties aliOssProperties){
|
||||||
|
log.info("开始创建阿里云上传文件工具类对象:{}",aliOssProperties);
|
||||||
|
return new AliOssUtil(aliOssProperties.getEndpoint(),
|
||||||
|
aliOssProperties.getAccessKeyId(),
|
||||||
|
aliOssProperties.getAccessKeySecret(),
|
||||||
|
aliOssProperties.getBucketName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.sky.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Slf4j
|
||||||
|
public class RedisConfigration {
|
||||||
|
@Bean
|
||||||
|
public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){
|
||||||
|
log.info("开始创建redis末模板对象...");
|
||||||
|
RedisTemplate redisTemplate = new RedisTemplate();
|
||||||
|
//设置redis的连接工厂对象
|
||||||
|
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||||
|
//设置redis key的序列化器
|
||||||
|
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||||
|
return redisTemplate;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue