default <T extends RegisteredService> T findServiceByExactServiceName(final String name, final Class<T> clazz) {
        val service = findServiceByExactServiceName(name);
        if (service == null) {
            return null;
        }

        if (!clazz.isAssignableFrom(service.getClass())) {
            throw new ClassCastException("Object [" + service + " is of type " + service.getClass()
                + " when we were expecting " + clazz);
        }
        return clazz.cast(service);
    }
Find service by exact service name t.

@param <T>   the type parameter
@param name  the name
@param clazz the clazz
@return the t
api/cas-server-core-api-services/src/main/java/org/apereo/cas/services/ServiceRegistry.java