| | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | |
| | | import java.io.File; |
| | | import java.text.ParseException; |
| | | |
| | | /** |
| | | * @author hehz |
| | |
| | | org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class}) |
| | | @EnableCaching |
| | | @EnableAsync |
| | | @EnableScheduling |
| | | public class AdminApplication extends SpringBootServletInitializer { |
| | | |
| | | @Value("${zt.oss.local-path}") |
| | |
| | | return factory; |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 3 * * ?") //每天3点执行 |
| | | public void timerListener() throws ParseException { |
| | | /* projectService.dropTemporaryTable(); |
| | | projectService.updateHasLifeData(); |
| | | this.deleteTempFile();*/ |
| | | } |
| | | // @Scheduled(cron = "0 0 3 * * ?") //每天3点执行 |
| | | // public void timerListener() throws ParseException { |
| | | ///* projectService.dropTemporaryTable(); |
| | | // projectService.updateHasLifeData(); |
| | | // this.deleteTempFile();*/ |
| | | // } |
| | | |
| | | private void deleteTempFile() { |
| | | String tempUploadDir = localPath + File.separator + "TEMP_UPLOAD"; |
| | |
| | | |
| | | @Bean |
| | | public RedisTemplate<String, Object> redisTemplate() { |
| | | try { |
| | | this.timerListener(); |
| | | } catch (Exception e) { |
| | | } |
| | | RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>(); |
| | | // 暂时先设置key和value的序列化都是字符串 |
| | | redisTemplate.setKeySerializer(new StringRedisSerializer()); |