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);
}
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());
}
}
Aggregations