Magento -Update -Attributwert ohne Verwendung von Object Manager

        <?php
    namespace vendor\module\Observer;
    
    class ProductSaveAfter implements \Magento\Framework\Event\ObserverInterface
    {
        public function __construct(
            \Magento\Backend\Model\Auth\Session $authSession,
            \Magento\Catalog\Model\ProductFactory $productFactory
        ) {
            $this->authSession = $authSession;
            $this->productFactroy = $productFactory;
        }
        public function execute(\Magento\Framework\Event\Observer $observer)
        {
            $user = $this->authSession->getUser()->getUsername();
            $productId = (int) $observer->getProduct()->getId();
            $product = $this->productFactroy->create()->load($productId);
            $product->addAttributeUpdate("updated_by", $user, 0);//attribute,value,storeid
        }
    }
Dharmesh Tukadiya