ModelRepository is always null

I want to check if a bpmn process already exists in Flowable Design with this code:

private ModelRepository modelRepository = new ModelRepositoryImpl()

List<Model> models = modelRepository.findByKeyAndType(processDefinition.getKey(), AbstractModel.MODEL_TYPE_BPMN);

Unfortunatly the tenantProvider, sqlSessionTemplate and idGenerator are null and it fails.
How do I need to create an instance of ModelRepository, so the attributes are not null?

Thank you in advance.