Spring data rest does't work with spring-data-mongodb and spring-cloud-stream #2489
Labels
status: waiting-for-feedback
We need additional information before we can continue
status: waiting-for-triage
An issue we've not yet triaged
Hello,
I have working on project using spring-data-rest and spring-data-mongodb and all work fine. when i have only add spring-cloud-stream spring-data api doesn't work any more.
Error
I have null pointer in this method (org.springframework.data.rest.webmvc.config.ResourceMetadataHandlerMethodArgumentResolver#resolveArgument) mappings.getMetadataFor(domainType) return null for mongo domaintype.
cause
The bean org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration#persistentEntities does't found MongoMappingContext when calling BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, MappingContext.class).values()), this is because persistentEntities is created when creating MongoMappingContext.
This is the chain of bean creation:
publishing event need all listner to be loaded so bean org.springframework.cloud.stream.function.FunctionConfiguration#streamBridgeUtils should be loaded.
streamBridgeUtils need bean org.springframework.cloud.function.context.config.ContextFunctionCatalogAutoConfiguration#functionCatalog
functionCatalog need all GenericConverter
so persistentEntities is loaded during MongoMappingContext creation and no way to change order.
version:
Spring-boot 3.4.5 same problem on 3.5.0
spring-cloud-starter-stream-kafka: 4.2.1
The text was updated successfully, but these errors were encountered: