After reading the mongo documentation that says each instance of a MongoClient handles its own pooling, how would I go about only having one instance across my whole applica
Since you are in a java ee environment, the best way to implement this would be to use CDI producers:
@Stateless
public class ConnetionFactory {
@ApplicationScoped
@Produces
public MongoClient mongoClient() {
return new MongoClient();
}
}
Then in every bean you want to use it in:
@Stateless
public class MyServiceBean {
@Inject
private MongoClient mongoClient;
}