Skip to content

Conversation

@quaff
Copy link
Contributor

@quaff quaff commented May 12, 2025

Such as BatchProperties.Jdbc, IntegrationProperties.Jdbc, JdbcSessionProperties and QuartzProperties.Jdbc

  1. Reuse Spring Boot's DatabaseInitializationMode
  2. Allow to customize platform
  3. add OnJdbcChatMemoryRepositoryDatasourceInitializationCondition for JdbcChatMemoryRepositorySchemaInitializer

… Boot

Such as `BatchProperties.Jdbc`, `IntegrationProperties.Jdbc`, `JdbcSessionProperties` and `QuartzProperties.Jdbc`

1. Reuse Spring Boot's `DatabaseInitializationMode`
2. Allow to customize platform
3. add `OnJdbcChatMemoryRepositoryDatasourceInitializationCondition` for `JdbcChatMemoryRepositorySchemaInitializer`

Signed-off-by: Yanming Zhou <[email protected]>
package org.springframework.ai.model.chat.memory.repository.jdbc.autoconfigure;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.sql.init.DatabaseInitializationMode;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have decided that the core of Spring AI will not depend on spring boot, for the chat repository work, we created our own enum for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, my bad, I mean thtat for the non autoconfig code.

@markpollack markpollack added this to the 1.0.0-RC1 milestone May 12, 2025

@Bean
@ConditionalOnMissingBean
@Conditional(OnJdbcChatMemoryRepositoryDatasourceInitializationCondition.class)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should merge this part into main

this.initializeSchema = initializeSchema;
}

public String getPlatform() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch.

@markpollack markpollack self-assigned this May 12, 2025
mode = DatabaseInitializationMode.EMBEDDED;
}
settings.setMode(mode);
settings.setSchemaLocations(resolveSchemaLocations(dataSource, properties));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to get the hsqldb autoconfiguration working with this, which is why there is all this code testing the URL. I agree this code in main needs to be improved, but without some more work on a better test that shows the hsqldb can automagically be configured, the current hack works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what I did wrong, as I had added all this extra code. Your PR is working, though i can't figure out what I did wrong ;)

@ilayaperumalg
Copy link
Member

@quaff Thanks for the PR! This simplifies our logic to initialise the JDBC Memory repository. Rebased and merged as e10fbde

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants