From 2cc8d04c929e0271cba6651ae7bb43bede50137e Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Wed, 7 Aug 2024 15:26:56 +0200 Subject: [PATCH] Update code snippet in documentation. Original Pull Request: #3093 --- .../ROOT/pages/repositories/custom-implementations.adoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/antora/modules/ROOT/pages/repositories/custom-implementations.adoc b/src/main/antora/modules/ROOT/pages/repositories/custom-implementations.adoc index e1f66a2f3..3c91ce0aa 100644 --- a/src/main/antora/modules/ROOT/pages/repositories/custom-implementations.adoc +++ b/src/main/antora/modules/ROOT/pages/repositories/custom-implementations.adoc @@ -303,7 +303,7 @@ In the example above `RepositoryMethodContext.currentMethod()` is used to retrie `RepositoryMethodContext` exposes information attached to the repository such as the domain type. In this case we use the repository domain type to identify the name of the index to be searched. -Now that you've got both, the fragment declaration and implementation you can register it in the `META-INF/spring.factories` file, package things up if needed, and you're good to go. +Now that you've got both, the fragment declaration and implementation you can register it in the `META-INF/spring.factories` file, package things up if needed, and you're almost good to go. .Registering a fragment implementation through `META-INF/spring.factories` ==== @@ -325,7 +325,7 @@ import org.springframework.data.repository.core.support.RepositoryFactoryBeanSup import org.springframework.lang.Nullable; @Configuration -class MyConfiguration implements BeanPostProcessor { +class MyConfiguration { @Bean static BeanPostProcessor exposeMethodMetadata() { @@ -338,6 +338,7 @@ class MyConfiguration implements BeanPostProcessor { if(bean instanceof RepositoryFactoryBeanSupport factoryBean) { factoryBean.setExposeMetadata(true); } + return bean; } }; }