commit
a318e386af
@ -0,0 +1,20 @@
|
|||||||
|
package com.sky;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
|
@EnableCaching //开启缓存注解功能
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableTransactionManagement //开启注解方式的事务管理
|
||||||
|
@Slf4j
|
||||||
|
@EnableScheduling //开启任务调度
|
||||||
|
public class SkyApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SkyApplication.class, args);
|
||||||
|
log.info("server started");
|
||||||
|
}
|
||||||
|
}
|
@ -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