TestConfiguration static class config{ Bean ChatMemory chatMemory(JdbcChatMemoryRepository chatMemoryRepository){ return MessageWindowChatMemory.builder() .maxMessages(10) .chatMemoryRepository(chatMemoryRepository) .build(); } }依赖以及添加yml配置dependency groupIdorg.springframework.ai/groupId artifactIdspring-ai-starter-model-chat-memory-repository-jdbc/artifactId /dependency !-- Spring Boot JDBC -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-jdbc/artifactId /dependency !-- MySQL 驱动 -- dependency groupIdcom.mysql/groupId artifactIdmysql-connector-j/artifactId scoperuntime/scope /dependencyspring: ai: dashscope: api-key: sk-ws-H.EMRYDEH.4LXn.MEUCIAz9Ti-AJ__aHclIwHL8LFhTkXEwV9LrbEzT2y1MjZgVAiEA3oUxKQWb7YHMGPt0zLcoBT3WYt-b1m5MfEcO-1sCo3Q chat: memory: repository: jdbc: initialize-schema: always #schema: classpath:schema-mysql.sql #聊天记录存储到数据库 application: name: chat-model datasource: url: jdbc:mysql://localhost:3306/springai?characterEncodingutf8useSSLfalseserverTimezoneUTC username: root password: 123456 driver-class-name: com.mysql.cj.jdbc.Driver