Skip to content

Move RepositoryMethodContext to repository.core package #3176

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 4 commits into from

Conversation

odrotbohm
Copy link
Member

@odrotbohm odrotbohm commented Oct 14, 2024

Details in the commit message.

@odrotbohm odrotbohm linked an issue Oct 14, 2024 that may be closed by this pull request
@mp911de mp911de self-assigned this Oct 15, 2024
@mp911de mp911de added the type: enhancement A general enhancement label Oct 15, 2024
@mp911de mp911de added this to the 3.4 RC1 (2024.1.0) milestone Oct 15, 2024
RepositoryConfigurationSource configurationSource) {

// A proxy RepositoryMethodContext for dependency injection
registerIfNotAlreadyRegistered(
Copy link
Member

Choose a reason for hiding this comment

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

Instance supplier is not supported in AOT and will raise org.springframework.beans.factory.aot.AotBeanProcessingException.

*
* @return will never be {@literal null}.
*/
public static RepositoryMethodContext getInjectionProxy() {
Copy link
Member

Choose a reason for hiding this comment

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

we'll need additional native image proxy configuration for RepositoryMethodContext.

@mp911de mp911de changed the title Allow injection of RepositoryMethodContext Move RepositoryMethodContext to repository.core package Oct 16, 2024
odrotbohm and others added 2 commits October 16, 2024 10:06
RepositoryMethodContext are now made available for dependency injection via RepositoryConfigurationExtensionSupport.registerBeansForRoot(…). Moved RMC into repository.core package (previously repository.core.support) and only expose factory methods on DefaultRepositoryMethodContext. DRMC also exposes a injection proxy lookup method that creates a proxy equipped with a TargetSource delegating to DRMC.getInstance() (previously ….getContext()). An additional, static DRMC.forMethod(…) allows the creation of a default instance for testing purposes.

Rename getRepository() to getMetadata() on RMC.

Fixes GH-3175.
@mp911de mp911de force-pushed the feature/3175 branch 2 times, most recently from be34301 to 5cd4d5d Compare October 16, 2024 08:12
Avoid nullability in RepositoryMethodContextHolder.getContext(). Introduce shortcut in RepositoryMethodContext to obtain the current thread-local context. Update documentation.
mp911de pushed a commit that referenced this pull request Oct 16, 2024
RepositoryMethodContext are now made available for dependency injection via RepositoryConfigurationExtensionSupport.registerBeansForRoot(…). Moved RMC into repository.core package (previously repository.core.support) and only expose factory methods on DefaultRepositoryMethodContext. DRMC also exposes a injection proxy lookup method that creates a proxy equipped with a TargetSource delegating to DRMC.getInstance() (previously ….getContext()). An additional, static DRMC.forMethod(…) allows the creation of a default instance for testing purposes.

Rename getRepository() to getMetadata() on RMC.

Fixes #3175.
Original pull request: #3176
mp911de pushed a commit that referenced this pull request Oct 16, 2024
mp911de added a commit that referenced this pull request Oct 16, 2024
Avoid nullability in RepositoryMethodContextHolder.getContext(). Introduce shortcut in RepositoryMethodContext to obtain the current thread-local context. Update documentation.

See #3175.
Original pull request: #3176
@mp911de
Copy link
Member

mp911de commented Oct 16, 2024

Thank you for your contribution. That's merged and polished now.

@mp911de mp911de closed this Oct 16, 2024
@mp911de mp911de deleted the feature/3175 branch October 16, 2024 09:00
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move RepositoryMethodContext to repository.core package
3 participants