@@ -277,28 +277,52 @@ public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fra
277277
278278 ApplicationStartup applicationStartup = getStartup ();
279279
280- StartupStep repositoryInit = applicationStartup .start ("spring.data.repository.init" );
281- repositoryInit .tag ("repository" , () -> repositoryInterface .getName ());
280+ StartupStep repositoryInit = onEvent (applicationStartup , "spring.data.repository.init" , repositoryInterface );
282281
283- StartupStep repositoryMetadataStep = applicationStartup .start ("spring.data.repository.metadata" );
282+ repositoryBaseClass .ifPresent (it -> repositoryInit .tag ("baseClass" , it .getName ()));
283+
284+ StartupStep repositoryMetadataStep = onEvent (applicationStartup , "spring.data.repository.metadata" ,
285+ repositoryInterface );
284286 RepositoryMetadata metadata = getRepositoryMetadata (repositoryInterface );
285287 repositoryMetadataStep .end ();
286288
287- StartupStep repositoryCompositionStep = applicationStartup .start ("spring.data.repository.composition" );
288- repositoryCompositionStep .tag ("fragment.count" , () -> String .valueOf (fragments .size ()));
289+ StartupStep repositoryCompositionStep = onEvent (applicationStartup , "spring.data.repository.composition" ,
290+ repositoryInterface );
291+ repositoryCompositionStep .tag ("fragment.count" , String .valueOf (fragments .size ()));
289292
290293 RepositoryComposition composition = getRepositoryComposition (metadata , fragments );
291294 RepositoryInformation information = getRepositoryInformation (metadata , composition );
295+
296+ repositoryCompositionStep .tag ("fragments" , () -> {
297+
298+ StringBuilder fragmentsTag = new StringBuilder ();
299+
300+ for (RepositoryFragment <?> fragment : composition .getFragments ()) {
301+
302+ if (fragmentsTag .length () > 0 ) {
303+ fragmentsTag .append (";" );
304+ }
305+
306+ fragmentsTag .append (fragment .getSignatureContributor ().getName ());
307+ fragmentsTag .append (fragment .getImplementation ().map (it -> ":" + it .getClass ().getName ()).orElse ("" ));
308+ }
309+
310+ return fragmentsTag .toString ();
311+ });
312+
292313 repositoryCompositionStep .end ();
293314
294315 validate (information , composition );
295316
296- StartupStep repositoryTargetStep = applicationStartup .start ("spring.data.repository.target" );
317+ StartupStep repositoryTargetStep = onEvent (applicationStartup , "spring.data.repository.target" ,
318+ repositoryInterface );
297319 Object target = getTargetRepository (information );
320+
321+ repositoryTargetStep .tag ("target" , target .getClass ().getName ());
298322 repositoryTargetStep .end ();
299323
300324 // Create proxy
301- StartupStep repositoryProxyStep = applicationStartup . start ( "spring.data.repository.proxy" );
325+ StartupStep repositoryProxyStep = onEvent ( applicationStartup , "spring.data.repository.proxy" , repositoryInterface );
302326 ProxyFactory result = new ProxyFactory ();
303327 result .setTarget (target );
304328 result .setInterfaces (repositoryInterface , Repository .class , TransactionalProxy .class );
@@ -309,30 +333,33 @@ public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fra
309333
310334 result .addAdvisor (ExposeInvocationInterceptor .ADVISOR );
311335
312- StartupStep repositoryPostprocessorsStep = applicationStartup .start ("spring.data.repository.postprocessors" );
313- postProcessors .forEach (processor -> {
314-
315- StartupStep singlePostProcessor = applicationStartup .start ("spring.data.repository.postprocessor" );
316- singlePostProcessor .tag ("type" , processor .getClass ().getName ());
317- processor .postProcess (result , information );
318- singlePostProcessor .end ();
319- });
320- repositoryPostprocessorsStep .end ();
336+ if (!postProcessors .isEmpty ()) {
337+ StartupStep repositoryPostprocessorsStep = onEvent (applicationStartup , "spring.data.repository.postprocessors" ,
338+ repositoryInterface );
339+ postProcessors .forEach (processor -> {
340+
341+ StartupStep singlePostProcessor = onEvent (applicationStartup , "spring.data.repository.postprocessor" ,
342+ repositoryInterface );
343+ singlePostProcessor .tag ("type" , processor .getClass ().getName ());
344+ processor .postProcess (result , information );
345+ singlePostProcessor .end ();
346+ });
347+ repositoryPostprocessorsStep .end ();
348+ }
321349
322350 if (DefaultMethodInvokingMethodInterceptor .hasDefaultMethods (repositoryInterface )) {
323351 result .addAdvice (new DefaultMethodInvokingMethodInterceptor ());
324352 }
325353
326- StartupStep queryExecutorsStep = applicationStartup .start ("spring.data.repository.queryexecutors" );
327354 ProjectionFactory projectionFactory = getProjectionFactory (classLoader , beanFactory );
328355 Optional <QueryLookupStrategy > queryLookupStrategy = getQueryLookupStrategy (queryLookupStrategyKey ,
329356 evaluationContextProvider );
330357 result .addAdvice (new QueryExecutorMethodInterceptor (information , projectionFactory , queryLookupStrategy ,
331358 namedQueries , queryPostProcessors , methodInvocationListeners ));
332- queryExecutorsStep .end ();
333359
334- composition = composition .append (RepositoryFragment .implemented (target ));
335- result .addAdvice (new ImplementationMethodExecutionInterceptor (information , composition , methodInvocationListeners ));
360+ RepositoryComposition compositionToUse = composition .append (RepositoryFragment .implemented (target ));
361+ result .addAdvice (
362+ new ImplementationMethodExecutionInterceptor (information , compositionToUse , methodInvocationListeners ));
336363
337364 T repository = (T ) result .getProxy (classLoader );
338365 repositoryProxyStep .end ();
@@ -346,19 +373,6 @@ public <T> T getRepository(Class<T> repositoryInterface, RepositoryFragments fra
346373 return repository ;
347374 }
348375
349- ApplicationStartup getStartup () {
350-
351- try {
352-
353- ApplicationStartup applicationStartup = beanFactory != null ? beanFactory .getBean (ApplicationStartup .class )
354- : ApplicationStartup .DEFAULT ;
355-
356- return applicationStartup != null ? applicationStartup : ApplicationStartup .DEFAULT ;
357- } catch (NoSuchBeanDefinitionException e ) {
358- return ApplicationStartup .DEFAULT ;
359- }
360- }
361-
362376 /**
363377 * Returns the {@link ProjectionFactory} to be used with the repository instances created.
364378 *
@@ -540,6 +554,25 @@ protected final <R> R getTargetRepositoryViaReflection(Class<?> baseClass, Objec
540554 baseClass , Arrays .stream (constructorArguments ).map (Object ::getClass ).collect (Collectors .toList ()))));
541555 }
542556
557+ private ApplicationStartup getStartup () {
558+
559+ try {
560+
561+ ApplicationStartup applicationStartup = beanFactory != null ? beanFactory .getBean (ApplicationStartup .class )
562+ : ApplicationStartup .DEFAULT ;
563+
564+ return applicationStartup != null ? applicationStartup : ApplicationStartup .DEFAULT ;
565+ } catch (NoSuchBeanDefinitionException e ) {
566+ return ApplicationStartup .DEFAULT ;
567+ }
568+ }
569+
570+ private StartupStep onEvent (ApplicationStartup applicationStartup , String name , Class <?> repositoryInterface ) {
571+
572+ StartupStep step = applicationStartup .start (name );
573+ return step .tag ("repository" , repositoryInterface .getName ());
574+ }
575+
543576 /**
544577 * Method interceptor that calls methods on the {@link RepositoryComposition}.
545578 *
0 commit comments