Exclude mongodb and data.mongodb namespaces from reflection contribution.

In some cases the users domain model may hold references to spring data or MongoDB specific types which should not be included in the reflection configuration as they are part of the static runtime hints configuration.

Closes #4248
Original pull request: #4249
This commit is contained in:
Christoph Strobl
2022-12-07 13:46:27 +01:00
committed by Mark Paluch
parent 8bcab93588
commit d050ae5732

View File

@@ -21,6 +21,7 @@ import org.springframework.data.mongodb.aot.MongoAotPredicates;
import org.springframework.data.repository.config.AotRepositoryContext;
import org.springframework.data.repository.config.RepositoryRegistrationAotProcessor;
import org.springframework.data.util.TypeContributor;
import org.springframework.data.util.TypeUtils;
/**
* @author Christoph Strobl
@@ -39,4 +40,13 @@ public class AotMongoRepositoryPostProcessor extends RepositoryRegistrationAotPr
lazyLoadingProxyAotProcessor.registerLazyLoadingProxyIfNeeded(type, generationContext);
});
}
@Override
protected void contributeType(Class<?> type, GenerationContext generationContext) {
if (TypeUtils.type(type).isPartOf("org.springframework.data.mongodb", "com.mongodb")) {
return;
}
super.contributeType(type, generationContext);
}
}