Are service autowiring and class autoresolving not anymore supported?
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