Skip to content

Commit 4e081b1

Browse files
committed
fix: Fix MongoChatMemoryIndexCreator not being scanned
Fixes #4839 Signed-off-by: Łukasz Jernaś <[email protected]>
1 parent 1df2af3 commit 4e081b1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

auto-configurations/models/chat/memory/repository/spring-ai-autoconfigure-model-chat-memory-repository-mongodb/src/main/java/org/springframework/ai/model/chat/memory/repository/mongo/autoconfigure/MongoChatMemoryIndexCreator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@
2020
import org.slf4j.LoggerFactory;
2121

2222
import org.springframework.ai.chat.memory.repository.mongo.Conversation;
23+
import org.springframework.boot.autoconfigure.AutoConfiguration;
2324
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
2425
import org.springframework.context.event.ContextRefreshedEvent;
2526
import org.springframework.context.event.EventListener;
2627
import org.springframework.data.domain.Sort;
2728
import org.springframework.data.mongodb.core.MongoTemplate;
2829
import org.springframework.data.mongodb.core.index.Index;
29-
import org.springframework.stereotype.Component;
3030

3131
/**
32-
* Class responsible for creating MongoDB proper indices for the ChatMemory. Creates a
32+
* Class responsible for creating proper MongoDB indices for the ChatMemory. Creates a
3333
* main index on the conversationId and timestamp fields, and a TTL index on the timestamp
3434
* field if the TTL is set in properties.
3535
*
3636
* @author Łukasz Jernaś
3737
* @see MongoChatMemoryProperties
3838
* @since 1.1.0
3939
*/
40-
@Component
40+
@AutoConfiguration
4141
@ConditionalOnProperty(value = "spring.ai.chat.memory.repository.mongo.create-indices", havingValue = "true")
4242
public class MongoChatMemoryIndexCreator {
4343

auto-configurations/models/chat/memory/repository/spring-ai-autoconfigure-model-chat-memory-repository-mongodb/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
# limitations under the License.
1515
#
1616
org.springframework.ai.model.chat.memory.repository.mongo.autoconfigure.MongoChatMemoryAutoConfiguration
17+
org.springframework.ai.model.chat.memory.repository.mongo.autoconfigure.MongoChatMemoryIndexCreator

0 commit comments

Comments
 (0)