跳到主要内容
未列出页
此页面未列出。搜索引擎不会对其索引,只有拥有直接链接的用户才能访问。

Strapi is a subclass of Container

In Strapi 5, Strapi is a subclass of the Container class to make it simpler to access services and unify the service access with one method.

This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

🔌 Is this breaking change affecting plugins?Yes
🤖 Is this breaking change automatically handled by a codemod?No

Breaking change description

In Strapi v4

Container methods are accessed like follows:

strapi.container.register(....)
strapi.container.get(...)

In Strapi 5

Container methods are accessed like follows:

strapi.add(....)
strapi.get(...)

Migration

This section regroups useful notes and procedures about the introduced breaking change.

Manual procedure

Ensure you update your method calls to container.