This should be an injected service. You can do that by implementing \Drupal\Core\Plugin\ContainerFactoryPluginInterface.

See \Drupal\action\Plugin\Action\EmailAction for an example.