class ServiceFactoryBean extends AbstractContractFactoryBean {

    protected Object  ref;

    protected Service service;

    public ServiceFactoryBean() {
    }

    public ServiceFactoryBean(String interfaceType) {
        this.interfaceType = interfaceType;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        super.afterPropertiesSet();
        if (!apiType && hasSofaServiceAnnotation()) {
            throw new ServiceRuntimeException(ErrorCode.convert("01-00103", beanId, ref.getClass()));
        }

        Implementation implementation = new DefaultImplementation();
        implementation.setTarget(ref);
        service = buildService();

        // default add jvm binding and service jvm binding should set serialize as true
        if (bindings.size() == 0) {
            JvmBindingParam jvmBindingParam = new JvmBindingParam().setSerialize(true);
            bindings.add(new JvmBinding().setJvmBindingParam(jvmBindingParam));
        }

        for (Binding binding : bindings) {
            service.addBinding(binding);
        }

        ComponentInfo componentInfo = new ServiceComponent(implementation, service,
            bindingAdapterFactory, sofaRuntimeContext);
        componentInfo.setApplicationContext(applicationContext);
        ComponentDefinitionInfo definitionInfo = new ComponentDefinitionInfo();
        definitionInfo.setInterfaceMode(apiType ? InterfaceMode.api : InterfaceMode.spring);
        definitionInfo.putInfo(BEAN_ID, beanId);
        Property property = new Property();
        property.setName(SOURCE);
        property.setValue(definitionInfo);
        componentInfo.getProperties().put(SOURCE, property);
        sofaRuntimeContext.getComponentManager().register(componentInfo);
    }

    private boolean hasSofaServiceAnnotation() {<FILL_FUNCTION_BODY>}

    @Override
    protected void setProperties(BindingConverterContext bindingConverterContext) {
        bindingConverterContext.setBeanId(beanId);
    }

    protected Service buildService() {
        return new ServiceImpl(uniqueId, getInterfaceClass(), InterfaceMode.spring, ref);
    }

    @Override
    public Object getObject() throws Exception {
        return service;
    }

    @Override
    public Class<?> getObjectType() {
        return service != null ? service.getClass() : Service.class;
    }

    @Override
    protected boolean isInBinding() {
        return false;
    }

    public void setRef(Object ref) {
        this.ref = ref;
    }
}

        Class<?> implementationClazz = ref.getClass();
        SofaService sofaService = implementationClazz.getAnnotation(SofaService.class);
        if (sofaService == null) {
            return false;
        }

        String annotationUniqueId = sofaService.uniqueId();
        if ((uniqueId == null || uniqueId.isEmpty())
            && (annotationUniqueId == null || annotationUniqueId.isEmpty())) {
            return true;
        }
        return annotationUniqueId.equals(uniqueId);
    
<methods>public non-sealed void <init>() ,public void afterPropertiesSet() throws java.lang.Exception,public java.lang.String getBeanId() ,public List<com.alipay.sofa.runtime.spi.binding.Binding> getBindings() ,public Class<?> getInterfaceClass() ,public java.lang.String getInterfaceType() ,public java.lang.String getUniqueId() ,public boolean isApiType() ,public boolean isSingleton() ,public void setApiType(boolean) ,public void setApplicationContext(org.springframework.context.ApplicationContext) throws org.springframework.beans.BeansException,public void setBeanId(java.lang.String) ,public void setBindingAdapterFactory(com.alipay.sofa.runtime.spi.binding.BindingAdapterFactory) ,public void setBindingConverterFactory(com.alipay.sofa.runtime.spi.service.BindingConverterFactory) ,public void setBindings(List<com.alipay.sofa.runtime.spi.binding.Binding>) ,public void setDocumentEncoding(java.lang.String) ,public void setElements(List<org.springframework.beans.factory.config.TypedStringValue>) ,public void setInterfaceClass(Class#RAW) ,public void setInterfaceType(java.lang.String) ,public void setRepeatReferLimit(java.lang.String) ,public void setSofaRuntimeContext(com.alipay.sofa.runtime.spi.component.SofaRuntimeContext) ,public void setUniqueId(java.lang.String) <variables>protected boolean apiType,protected org.springframework.context.ApplicationContext applicationContext,protected java.lang.String beanId,protected com.alipay.sofa.runtime.spi.binding.BindingAdapterFactory bindingAdapterFactory,protected com.alipay.sofa.runtime.spi.service.BindingConverterFactory bindingConverterFactory,protected List<com.alipay.sofa.runtime.spi.binding.Binding> bindings,protected java.lang.String documentEncoding,protected List<org.springframework.beans.factory.config.TypedStringValue> elements,protected Class<?> interfaceClass,protected java.lang.String interfaceType,protected java.lang.String repeatReferLimit,protected com.alipay.sofa.runtime.spi.component.SofaRuntimeContext sofaRuntimeContext,protected java.lang.String uniqueId