Constantize class if it is a string, before invoking middleware