Missing hint issue when defining a custom MongoTemplate. #4763
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I have a Spring Boot service where I save data to different databases at runtime. Additionally, I need to customize some settings based on certain conditions. Therefore, I create custom MongoTemplate beans. My implementation works successfully. So, under normal conditions, I can save my data to different databases and my code works.
However, when I build my project as a native image, it throws an error during startup. For now, I have solved the problem by adding the relevant class as a hint in my project. However, I wanted to contribute by opening a pull request for this issue.
To help you reproduce the issue, I am sharing a POC project. If you follow the steps in the README.md file on the main branch, you will encounter the error. Additionally, you can switch to the solution branch to see if the solution works.
Spring Boot Version : 3.3.2
The branch link where you can reproduce the error : https://github.com/omercelikceng/native-poc-mongodb-error/tree/main
The branch link where the error is resolved : https://github.com/omercelikceng/native-poc-mongodb-error/tree/solution
Error :