简体   繁体   中英

Mezzio => Service not registered

I have created a new module named ModuleA, which contains a middleware named MiddlewareA. I also have created a route (eg "login") which has MiddlewareA in its pipeline.

When I send a request to the path "login", get response which states that

Service MiddlewareA not registered

What is the solution to this problem?

Please check if you have added the new module to the composer.json file of the project, like:

"autoload": {
    "psr-4": {
        "App\\": "src/App/src/",
        "ModuleA\\": "src/ModuleA/src/"
    }
},

After that please run this command on the project route:

composer dump-autoload

Please proceed these steps every time you create a new Module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM