@SuppressWarnings("unchecked")
    public <T> T getBean(String id, Class<T> requiredType) {
        if (requiredType == null) {
            throw new NullPointerException("requiredType argument cannot be null.");
        }
        Object bean = getBean(id);
        if (bean == null) {
            return null;
        }
        Assert.state(requiredType.isAssignableFrom(bean.getClass()),
                "Bean with id [" + id + "] is not of the required type [" + requiredType.getName() + "].");
        return (T) bean;
    }
Plug in another way to get objects into configuration, ex: CDI

@param alternateObjectSupplier not null (empty lambda ok)
@since 2.0
config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java