Use Definition::setFactory() to register factory