@Override
    public void export(RegisterTypeEnum registerType) {
        if (this.exported) {
            return;
        }

        if (getScopeModel().isLifeCycleManagedExternally()) {
            // prepare model for reference
            getScopeModel().getDeployer().prepare();
        } else {
            // ensure start module, compatible with old api usage
            getScopeModel().getDeployer().start();
        }

        synchronized (this) {
            if (this.exported) {
                return;
            }

            if (!this.isRefreshed()) {
                this.refresh();
            }
            if (this.shouldExport()) {
                this.init();

                if (shouldDelay()) {
                    // should register if delay export
                    doDelayExport();
                } else if (Integer.valueOf(-1).equals(getDelay())
                        && Boolean.parseBoolean(ConfigurationUtils.getProperty(
                                getScopeModel(), CommonConstants.DUBBO_MANUAL_REGISTER_KEY, "false"))) {
                    // should not register by default
                    doExport(RegisterTypeEnum.MANUAL_REGISTER);
                } else {
                    doExport(registerType);
                }
            }
        }
    }
@Test
    void testMethodConfigWithConfiguredArgumentTypeAndIndex() {
        ServiceConfig<DemoServiceImpl> service = new ServiceConfig<>();

        service.setInterface(DemoService.class);
        service.setRef(new DemoServiceImpl());
        service.setProtocol(new ProtocolConfig() {
            {
                setName("dubbo");
            }
        });

        MethodConfig methodConfig = new MethodConfig();
        methodConfig.setName("sayName");
        // invalid argument index.
        methodConfig.setArguments(Lists.newArrayList(new ArgumentConfig() {
            {
                setType(String.class.getName());
                setIndex(0);
                setCallback(false);
            }
        }));
        service.setMethods(Lists.newArrayList(methodConfig));

        service.export();

        assertFalse(service.getExportedUrls().isEmpty());
        assertEquals("false", service.getExportedUrls().get(0).getParameters().get("sayName.0.callback"));
    }