Composite Menu with custom addons

I have some custom Addons which use some Jmix Addons.
I have some custom Applications which use some custom Addons.
I have one app by customer, common code is in custom Addons.

By default my menu is composite and I get all Addons menu.xml.
But I want to have a custom menu where I can organize as I want.

I have too much applications and custom addons to use single menu in each application.
So I would like to have a composite menu in my applications, but only get my custom Addons menu.xml
where I set up as I want (and not get Jmix Addons menu.xml).

So I think it’s possible If I override the bean ui_MenuConfig, and add a filter on locations in the idea below.

@Component("my_MenuConfig")
@Primary
public class MyMenuConfig extends MenuConfig {
    ...
    protected void init() {
        rootItems.clear();

        List<String> locations = uiProperties.isCompositeMenu() ?
                modules.filter { TODO }.getPropertyValues(MENU_CONFIG_XML_PROP) :
                Collections.singletonList(environment.getProperty(MENU_CONFIG_XML_PROP));

        ...
    }
    ...
}

Is there a better solution ?

Hello, @b.vallettedosia

Yes, extension of MenuConfig#init() should be the best solution in such case.

Regards,
Dmitry