Dependency injection or \Drupal class methods? Suppose I have an ExampleService  class and I need a service (current_user) to process my logic. So I have implemented my service like this.

The way 1: DI standard Drupal

namespace Drupal\example_service;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Session\AccountProxy;

class ExampleService implements ContainerInjectionInterface {
    /**
   * Drupal\Core\Session\AccountProxy definition.
   *
   * @var \Drupal\Core\Session\AccountProxy
   */
    protected $currentUser;

    public function __construct(AccountProxy $current_user) {
        $this-&gt;currentUser = $current_user;
    }

    public static function create(ContainerInterface $container) {
        return new static(
          $container-&gt;get('current_user')
        );
    }
}


The way 2: Use global service

namespace Drupal\example_service;

class ExampleService {
    /**
   * Drupal\Core\Session\AccountProxy definition.
   *
   * @var \Drupal\Core\Session\AccountProxy
   */
    protected $currentUser;

    public function __construct(AccountProxy $current_user) {
        $this-&gt;currentUser = \Drupal::service('current_user');
    }
}


What is the difference between these methods?
What is better for performance?
In Drupal 8, you should always use dependency injection within the context of classes.

However, if you create a custom service, you don't have to manually implement the ContainerInjectionInterface.

Instead, you define your service and the arguments for the constructor within your module's example_service.services.yml file (read more about .services.yml files here and about service injection here):

services:
  example_service.my_service:
    class: Drupal\example_service\ExampleService
    arguments: ['@current_user']


And your service class like this:

&lt;?php

namespace Drupal\example_service;

use Drupal\Core\Session\AccountProxyInterface;

/**
 * My Example service.
 */
class ExampleService {

  /**
   * The current user.
   *
   * @var \Drupal\Core\Session\AccountProxyInterface
   */
  protected $currentUser;

  /**
   * Construct an example service instance.
   *
   * @param \Drupal\Core\Session\AccountProxyInterface $current_user
   *   Account proxy for the currently logged-in user.
   */
  public function __construct(AccountProxyInterface $current_user) {
    $this-&gt;currentUser = $current_user;
  }

}


Then you can create an instance of your custom service either via dependency injection as well (within the scope of another class), or within your module/theme files by using:

/* @var $my_service \Drupal\example_service\ExampleService */
$my_service = \Drupal::service('example_service.my_service');