jeeplus框架启动报错;跨域问题;定时器只执行第一次或者不执行;http get请求问题;GROUP BY子句中,包含非聚合列‘某参数‘

1.jeeplus框架启动报错

报错:

org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?; nested exception is java.io.InvalidClassException: com.jeeplus.sys.service.dto.UserDTO; incompatible types for field isAdmin

解决:

用another redis工具删除Redis中记录

2.跨域问题

添加文件

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

@Configuration
public class MyCorsConfig {

    private CorsConfiguration corsConfig() {
        CorsConfiguration corsConfiguration = new CorsConfiguration();
        corsConfiguration.addAllowedOriginPattern("*");
        corsConfiguration.addAllowedHeader("*");
        corsConfiguration.addAllowedMethod("*");
        corsConfiguration.setAllowCredentials(true);
        corsConfiguration.setMaxAge(3600L);
        return corsConfiguration;
    }

    @Bean
    public CorsFilter corsFilter() {
        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        source.registerCorsConfiguration("/**", corsConfig());
        return new CorsFilter(source);
    }
}

3.定时器只执行第一次或者不执行

定时器类:

方法上注解 @Scheduled(cron = "0 0/5 * * * ?")

类上注解: @Component

主启动类注解: @EnableScheduling

采用定时线程池:

先在主启动类中加载线程池,再在定时任务加注解,选择对应的线程池名称

@Async(value = "taskThreadPoolExecutor")

****************************************************************

程序加载只执行一次或者不执行,加定时器多线程配置:

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.util.concurrent.ScheduledThreadPoolExecutor;

/**
 * 定时器多线程配置
 * @author lu
 * @date 2022年08月12日 13:43
 */
@Configuration
public class ScheduleConfig implements SchedulingConfigurer {
//    @Override
//    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
//        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
//        taskScheduler.setPoolSize(10);
//        taskScheduler.initialize();
//        taskRegistrar.setTaskScheduler(taskScheduler);
//    }

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.setScheduler(new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),
                r -> new Thread(r,"my-schedule")));
    }


}

4.http get请求,传值时间参数yyyy-MM-dd HH:mm:ss,有空格,400

URLEncoder.encode("timestamp","utf-8")

将该参数转码放置

5.不在GROUP BY子句中,包含非聚合列'某参数',该列在功能上不依赖于GROUP BY子句中的列;这与sql_mode=only_full_group_by不兼容

select 查询参数不在group by中的,将该查询参数改为:any_value(a.deve_code) as deve_code

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值