private Set<Class<?>> findAndLoadComponents(final String basePackage,
                                                final ClassPathScanningCandidateComponentProvider componentProvider) {
        return FunctionUtils.doUnchecked(() -> {
            val initialEntitySet = new HashSet<Class<?>>();
            for (val candidate : componentProvider.findCandidateComponents(basePackage)) {
                val beanClassName = Objects.requireNonNull(candidate.getBeanClassName());
                initialEntitySet.add(ClassUtils.forName(beanClassName, getClass().getClassLoader()));
            }
            return initialEntitySet;
        });
    }
Build mongo template.

@param mongoClient the mongo client
@param mongo       the mongo
@return the cas mongo operations
support/cas-server-support-mongo-core/src/main/java/org/apereo/cas/mongo/MongoDbConnectionFactory.java