Fetch Attribute Id from the attribute code in Magento 2 by using AttributeRepository Interface Class.
You need the Entity type value and the attribute code.
Just instantiate the Magento\Eav\Api\AttributeRepositoryInterface class to retrieve the id value.
