Correct way to access Yii2 components in your modules?
Use Yii::$app->getModule('fooModule')->testComponent->exampleFunction();
for access module component.
The most elegant way to access module component from module controller without hardcoding module's ID is as follows:
$this->module->testComponent->exampleFunction();