-
Notifications
You must be signed in to change notification settings - Fork 2k
Align JdbcChatMemoryRepositoryProperties with other modules in Spring Boot #3107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
|
||
| @Bean | ||
| @ConditionalOnMissingBean | ||
| @Conditional(OnJdbcChatMemoryRepositoryDatasourceInitializationCondition.class) |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
| mode = DatabaseInitializationMode.EMBEDDED; | ||
| } | ||
| settings.setMode(mode); | ||
| settings.setSchemaLocations(resolveSchemaLocations(dataSource, properties)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ;)
Such as
BatchProperties.Jdbc,IntegrationProperties.Jdbc,JdbcSessionPropertiesandQuartzProperties.JdbcDatabaseInitializationModeOnJdbcChatMemoryRepositoryDatasourceInitializationConditionforJdbcChatMemoryRepositorySchemaInitializer