So, this is our plugin class--HelloWorldSalutationBlock--that does just that:
namespace Drupal\hello_world\Plugin\Block;use Drupal\Core\Block\BlockBase;use Drupal\Core\Plugin\ContainerFactoryPluginInterface;use Symfony\Component\DependencyInjection\ContainerInterface;use Drupal\hello_world\HelloWorldSalutation as HelloWorldSalutationService;/** * Hello World Salutation block. * * @Block( * id = "hello_world_salutation_block", * admin_label = @Translation("Hello world salutation"), * ) */class HelloWorldSalutationBlock extends BlockBase implements ContainerFactoryPluginInterface { /** * Drupal\hello_world\HelloWorldSalutation definition. * * @var \Drupal\hello_world\HelloWorldSalutation */ protected $salutation; /** ...