How to set a resource for a model?

Let’s see an example from the core:

The declaration sets the Magento\Config\Model\ResourceModel\Config\Data as a resource model class for the Magento\Framework\App\Config\Value model.