Search in sources :

Example 1 with ProducerMeta

use of org.apache.servicecomb.core.provider.producer.ProducerMeta in project incubator-servicecomb-java-chassis by apache.

the class RestProducers method processProvider.

protected void processProvider(String beanName, Object bean) {
    // aop后,新的实例的父类可能是原class,也可能只是个proxy,父类不是原class
    // 所以,需要先取出原class,再取标注
    Class<?> beanCls = BeanUtils.getImplClassFromBean(bean);
    RestSchema restSchema = beanCls.getAnnotation(RestSchema.class);
    if (restSchema == null) {
        return;
    }
    ProducerMeta producerMeta = new ProducerMeta(restSchema.schemaId(), bean, beanCls);
    producerMetaList.add(producerMeta);
}
Also used : ProducerMeta(org.apache.servicecomb.core.provider.producer.ProducerMeta)

Example 2 with ProducerMeta

use of org.apache.servicecomb.core.provider.producer.ProducerMeta in project incubator-servicecomb-java-chassis by apache.

the class RestProducerProvider method init.

@Override
public void init() throws Exception {
    for (ProducerMeta producerMeta : restProducers.getProducerMetaList()) {
        Microservice microservice = RegistryUtils.getMicroservice();
        producerSchemaFactory.getOrCreateProducerSchema(microservice.getServiceName(), producerMeta.getSchemaId(), producerMeta.getInstanceClass(), producerMeta.getInstance());
    }
}
Also used : ProducerMeta(org.apache.servicecomb.core.provider.producer.ProducerMeta) Microservice(org.apache.servicecomb.serviceregistry.api.registry.Microservice)

Aggregations

ProducerMeta (org.apache.servicecomb.core.provider.producer.ProducerMeta)2 Microservice (org.apache.servicecomb.serviceregistry.api.registry.Microservice)1