Are service autowiring and class autoresolving not anymore supported? In Drupal 8, I needed to define services via the mymodule.services.yml file only, if I wanted to use them via the service container. I could also autowire them and the classes were automatically resolved.
services:
  my_module.twitter_feed:
    class: Drupal\my_module\TwitterFeed
    autowire: true

  domcrawler.crawler:
    class: Symfony\Component\DomCrawler\Crawler
    public: false

In Drupal 9, it looks like I must define all my custom classes inside the mymodule.services.yml file. Drupal 9 seems not to be able to identify my classes without an entry within the mymodule.services.yml file. There seems to be no autoresolving anymore. Symfony 4 and 5 are able to do that and Symfony 3.x (Drupal 8) was definitely able to autowire services and find classes by its own. Drupal seems to have its own service container, which suppresses that functionality.
Defining every single PHP class within a *.services.yml file is a huge amount of work for upgrading and maintaining my project. I cannot believe that Drupal 9 requires this work, because the Symfony framework already does that automatically.
Do you know any way to re-enable PHP class autowiring and autoresolving in an upgrade from Drupal 8 to 9?
I hope that anybody else was struggling with autowiring during an upgrade from Drupal 8 to 9 and knows any solution.
I found out, that in Drupal 9 some autowiring &quot;magic&quot; from Drupal 8 was removed. Drupal also overrides the Symfony dependency injection by its own logic. Therefor you must write your own service provider class in your module to autowire your service containers (basically all PHP classes, except e.g. Drupal Plugins or Drupal Entities, which Drupal 9 resolves by its own).
Like this (path: modules/custom/my_nice_module/MyNiceModuleServiceProvider.php):
&lt;?php
declare(strict_types=1);

namespace Drupal\my_nice_module;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\Finder\Finder;


class MyNiceModuleServiceProvider extends ServiceProviderBase {

  public function register(ContainerBuilder $container) {
    $containerModules = $container-&gt;getParameter('container.modules');
    $finder = new Finder();

    $foldersWithServiceContainers = [];

    $foldersWithServiceContainers['Drupal\my_nice_module\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/')-&gt;files()-&gt;name('*.php');

    $foldersWithServiceContainers['Drupal\my_nice_module\Transformer\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Transformer/')-&gt;files()-&gt;name('*.php');
    $foldersWithServiceContainers['Drupal\my_nice_module\Transformer\RegionalCouncilMeeting\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Transformer/RegionalCouncilMeeting/')-&gt;files()-&gt;name('*.php');


    $foldersWithServiceContainers['Drupal\my_nice_module\DomCrawler\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/DomCrawler/')-&gt;files()-&gt;name('*.php');
    $foldersWithServiceContainers['Drupal\my_nice_module\MongoDBFetcher\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/MongoDBFetcher/')-&gt;files()-&gt;name('*.php');

    $foldersWithServiceContainers['Drupal\my_nice_module\Importer\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Importer/')-&gt;files()-&gt;name('*.php');
    $foldersWithServiceContainers['Drupal\my_nice_module\Importer\MongoDB\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Importer/MongoDB/')-&gt;files()-&gt;name('*.php');
    $foldersWithServiceContainers['Drupal\my_nice_module\Importer\RegionalCouncilMeetingsArchive\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Importer/RegionalCouncilMeetingsArchive/')-&gt;files()-&gt;name('*.php');

    $foldersWithServiceContainers['Drupal\my_nice_module\Entity\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Entity/')-&gt;files()-&gt;name('*.php');
    $foldersWithServiceContainers['Drupal\my_nice_module\Extractor\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Extractor/')-&gt;files()-&gt;name('*.php');
    $foldersWithServiceContainers['Drupal\my_nice_module\Service\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/Service/')-&gt;files()-&gt;name('*.php');
    $foldersWithServiceContainers['Drupal\my_nice_module\DrushCommandFacade\\'] = $finder-&gt;in(dirname($containerModules['my_nice_module']['pathname']) . '/src/DrushCommandFacade/')-&gt;files()-&gt;name('*.php');

    foreach ($foldersWithServiceContainers as $namespace =&gt; $files) {
      foreach ($finder as $fileInfo) {
        $class = $namespace
          . substr($fileInfo-&gt;getFilename(), 0, -4);
        // don't override any existing service
        if ($container-&gt;hasDefinition($class)) {
          continue;
        }
        $definition = new Definition($class);
        $definition-&gt;setAutowired(TRUE);
        $container-&gt;setDefinition($class, $definition);
      }
    }
  }

}

Here is a good presentation about this: https://events.drupal.org/sites/default/files/slides/drupalcon.2019.autowiring.pdf
The Autoservices Drupal module can also be a good example for your own solution: https://gitlab.com/upstreamable/drupal-autoservices