fix: Spring 多构造器类显式 @Autowired 标注 + V95 迁移兼容 MySQL 8.4
Build Backend JAR / build (push) Has been cancelled
Build Backend JAR / build (push) Has been cancelled
- CapacityPlanService / ExternalCallMetricsRecorder / ZiniaoClientImpl: 双构造器(生产 + 测试入口)导致 Spring 6 不自动推断构造器注入, 启动报 'No default constructor found';生产构造器显式加 @Autowired - V95:shop_key 列 V85 建表时已有,原 ADD COLUMN shop_key 会报 duplicate column;MySQL 8.4 不支持 ADD COLUMN IF NOT EXISTS,改 information_schema 动态 SQL;shop_key 缩到 VARCHAR(255) 以容纳 (shop_key, business_date) 唯一键(1000 在 utf8mb4 下超 3072 字节 索引上限);删除多余行改为单表 DELETE
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.nanri.aiimage.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -20,7 +21,8 @@ public class CapacityPlanService implements CommandLineRunner {
|
||||
private final CapacityPlanProperties properties;
|
||||
private final long machineMaxMemoryBytes;
|
||||
|
||||
/** 供测试注入机器内存字节数;生产构造时取 Runtime.maxMemory()。 */
|
||||
/** 生产构造:测试用双参构造器存在,Spring 不会自动推断,必须显式 @Autowired。 */
|
||||
@Autowired
|
||||
public CapacityPlanService(CapacityPlanProperties properties) {
|
||||
this(properties, maxMemoryBytes());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user