Use route annotation I'm trying to create my first module. I'd like to know if I can use annotation route like Symfony instead of separated files.

For example, can I use the second snippet instead of the first one?

hello_world_settings:
  path:  '/hello/world'
  defaults:
    _content:  '\Drupal\hello_world\Controller\HelloWorldController::myCallbackMethod'
  title: 'Hello World'
  requirements:
    _permission: 'access content'




/**
 * @Route("/hello/world",name="hello_world")
 * @Method({"GET"})
 */
 public function myCallbackMethod() {
AFAIK, Drupal doesn't support any of the Symfony route annotations.  The code is present in vendor/, but not used by core.

The closest thing is the concept of Entity links, which are part of the Doctrine annotations on the entity class.  These link names can be used in the ::toUrl() method to generate the canonical link for an entity, the edit link, etc.  However, the routes still need to be defined in the routing.yml file.