Skip to content
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

Revisit configuration model of KeyValueRepositoryConfigurationExtension #363

Open
mp911de opened this issue Mar 17, 2021 · 0 comments
Open
Labels
in: repository Repositories abstraction

Comments

@mp911de
Copy link
Member

mp911de commented Mar 17, 2021

KeyValueRepositoryConfigurationExtension (enabled through @EnableMapRepositories or @EnableRedisRepositories) attempts to create default beans if there are no bean definitions already registered. This happens mostly for KeyValueTemplate and the MappingContext.

For Redis, there are a couple more beans involved. When using multiple configuration classes, the processing of KeyValueRepositoryConfigurationExtension depends on the actual order in which bean registrations are been made. Defining a template bean in one config class and declaring @EnableMapRepositories on a different class can lead to the state where KeyValueRepositoryConfigurationExtension does not yet see the bean declaration and thus two beans get registered.

We should back off from this type of defaulting and ideally try to reduce the number of required beans. Besides that, we should investigate a configuration model that tries to supply missing beans/components through a BeanPostProcessor.

In the case of Map repositories:

Check whether a KeyValueRepositoryFactoryBean is associated with a MappingContext/QueryCreator/KeyValueOperations prior to bean initialization so that defaulting applies as late as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository Repositories abstraction
Projects
None yet
Development

No branches or pull requests

1 participant