I am trying to use MongoDB 4 in a spring boot application and trying to run on open liberty server. I searched for example and all show that we need to use CDI producer to use with any version of Mongo. The examples show that we can use with Microprofile. However I have a requirement to use in a spring boot application. Please see statement from IBM site.
The mongodb-2.0 feature is stabilized. The MongoDB Java driver versions 2.10.0 to 2.14.2 that the feature supports are no longer in service. Instead of using the mongodb-2.0 feature, create a CDI producer for Mongo. The CDI producer can use any Mongo version that meets your requirements.
I searched stack overflow and found a similar sort of question. But the anwers provided again asks to use the CDI producer.
Container managed MongoDB Connection in Liberty + Spring Data
Appreciate help on whether it is possible to have a spring boot project accessing MongoDB4 to run on Open Liberty server.
Despite the recommendation that is cited in the mondgodb-2.0 stabilization text, there is no requirement to use CDI in Liberty in order to use Mongo. The CDI producer idea/example is provided as a convenience to anyone who was using the old Liberty mongodb-2.0 feature and wants to similarly get Liberty to manage the life cycle of a single shared mongo client instance. It's perfectly fine to forego the use of CDI and just use the Mongo driver interfaces directly (or to let Spring do so).