The reference may be specified as a string or an Instance object. If the former,
it will be treated as a component ID, a class/interface name or an alias, depending on the container type.
If you do not specify a container, the method will first try Yii::$app followed by Yii::$container.
For example,
php
use yii\db\Connection;
returns Yii::$app->db
$db = Instance::ensure('db', Connection::className());
returns an instance of Connection using the given configuration
$db = Instance::ensure(['dsn' => 'sqlite:path/to/my.db'], Connection::className());