2626import org .apache .commons .logging .Log ;
2727import org .apache .commons .logging .LogFactory ;
2828import org .jspecify .annotations .Nullable ;
29-
3029import org .springframework .aot .generate .GenerationContext ;
3130import org .springframework .aot .hint .MemberCategory ;
32- import org .springframework .aot .hint .RuntimeHints ;
3331import org .springframework .aot .hint .TypeReference ;
34- import org .springframework .aot .hint .annotation .ReflectiveRuntimeHintsRegistrar ;
3532import org .springframework .beans .BeansException ;
3633import org .springframework .beans .factory .BeanFactory ;
3734import org .springframework .beans .factory .BeanFactoryAware ;
@@ -216,7 +213,7 @@ protected void registerRepositoryCompositionHints(AotRepositoryContext repositor
216213 * @param generationContext the generation context.
217214 * @since 4.0
218215 */
219- private void configureTypeContributions (AotRepositoryContext repositoryContext , GenerationContext generationContext ) {
216+ protected void configureTypeContributions (AotRepositoryContext repositoryContext , GenerationContext generationContext ) {
220217
221218 RepositoryInformation information = repositoryContext .getRepositoryInformation ();
222219
@@ -243,25 +240,22 @@ private void configureTypeContributions(AotRepositoryContext repositoryContext,
243240 * ({@link AotRepositoryContext#getResolvedTypes()})
244241 *
245242 * @param repositoryContext the repository context.
246- * @param generationContext the generation context.
247243 * @since 4.0
248244 */
249- protected void configureDomainTypeContributions (AotRepositoryContext repositoryContext ,
250- GenerationContext generationContext ) {
245+ private void configureDomainTypeContributions (AotRepositoryContext repositoryContext , GenerationContext generationContext ) {
251246
252247 RepositoryInformation information = repositoryContext .getRepositoryInformation ();
253- RuntimeHints hints = generationContext .getRuntimeHints ();
254248
255249 // Domain types, related types, projections
256- ReflectiveRuntimeHintsRegistrar registrar = new ReflectiveRuntimeHintsRegistrar ();
250+ repositoryContext .typeConfiguration (information .getDomainType (), config -> config .forDataBinding ().forQuerydsl ());
251+
257252 Stream .concat (Stream .of (information .getDomainType ()), information .getAlternativeDomainTypes ().stream ())
258253 .forEach (it -> {
259-
260- registrar .registerRuntimeHints (hints , it );
261- configureTypeContribution (it , repositoryContext );
254+ repositoryContext .typeConfiguration (information .getDomainType (),
255+ config -> config .forDataBinding ().forQuerydsl ().contributeAccessors ());
262256 });
263257
264- // TODO: Looks like a duplicate
258+ // Domain types my be part of this, but it also contains reachable ones.
265259 repositoryContext .getResolvedTypes ().stream ()
266260 .filter (it -> TypeContributor .isPartOf (it , Set .of (information .getDomainType ().getPackageName ())))
267261 .forEach (it -> configureTypeContribution (it , repositoryContext ));
0 commit comments