code: def startup(self, app):
          
          self.database.init_async(app.loop)
          if not self.cfg.connection_manual:
              app.middlewares.insert(0, self._middleware)
docs: Register connection's middleware and prepare self database.