因为数据库连接问题导致的插入数据库异常
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package com.rj.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
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.time.Clock;
|
||||
|
||||
/**
|
||||
* 显式扩大 {@code @Scheduled} 线程池,避免单个耗时任务(如长时间 HTTP)占满默认单线程后拖死全部定时任务。
|
||||
* <p>与 {@code spring.task.scheduling.pool.size} 配置互补;此处代码保证至少 8 个调度线程。
|
||||
@@ -14,6 +17,11 @@ public class AppSchedulingConfiguration implements SchedulingConfigurer {
|
||||
|
||||
private static final int SCHEDULER_POOL_SIZE = 8;
|
||||
|
||||
@Bean
|
||||
public Clock applicationClock() {
|
||||
return Clock.systemDefaultZone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
|
||||
34
src/main/java/com/rj/config/HxrAdminProperties.java
Normal file
34
src/main/java/com/rj/config/HxrAdminProperties.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.rj.config;
|
||||
|
||||
import com.rj.scheduler.LBAdminPullScheduler;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* hxrd 后台订单列表拉取(供 {@link LBAdminPullScheduler} 使用)。
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "hxr.admin")
|
||||
public class HxrAdminProperties {
|
||||
|
||||
/**
|
||||
* 是否启用拉取任务;未启用时不发 HTTP 请求。
|
||||
*/
|
||||
private boolean enabled = true;
|
||||
|
||||
/**
|
||||
* 完整请求 URL(含查询串),与浏览器地址栏一致即可。
|
||||
*/
|
||||
private String orderSelectUrl =
|
||||
"https://hxrdhoutai.hxrdsm.cn/app/admin/order/select?page=1&limit=90";
|
||||
|
||||
/**
|
||||
* 请求头 Cookie 完整取值,例如 {@code PHPSID=xxxx}。非空时优先于 {@link #phpsid}。
|
||||
*/
|
||||
private String cookie = "";
|
||||
|
||||
/**
|
||||
* 仅 PHPSID 会话值(不含 {@code PHPSID=} 前缀);在 {@link #cookie} 为空时使用。
|
||||
*/
|
||||
private String phpsid = "";
|
||||
}
|
||||
Reference in New Issue
Block a user