@Override
    public <T> T newObjectInstance(final String classText, final Class<T> expectedType) throws Exception {
        try (val classLoader = (GroovyClassLoader) newClassLoader()) {
            val clz = classLoader.parseClass(classText);
            return expectedType.cast(clz.getDeclaredConstructor().newInstance());
        }
    }
This is {@link GroovyExecutableCompiledScriptFactory}.

@author Misagh Moayyed
@since 7.1.0
core/cas-server-core-scripting/src/main/java/org/apereo/cas/util/scripting/GroovyExecutableCompiledScriptFactory.java