com.tencent.trpc.spring.context.TRpcClientFactoryBean Maven / Gradle / Ivy
/*
* Tencent is pleased to support the open source community by making tRPC available.
*
* Copyright (C) 2023 THL A29 Limited, a Tencent company.
* All rights reserved.
*
* If you have downloaded a copy of the tRPC source code from Tencent,
* please note that tRPC source code is licensed under the Apache 2.0 License,
* A copy of the Apache 2.0 License can be found in the LICENSE file.
*/
package com.tencent.trpc.spring.context;
import com.tencent.trpc.core.rpc.TRpcProxy;
import java.util.Objects;
import org.springframework.beans.factory.FactoryBean;
/**
* {@link FactoryBean} for tRPC clients.
*
* @see TRpcProxy#getProxy(String, Class)
*/
public class TRpcClientFactoryBean implements FactoryBean {
private final String name;
private final Class serviceInterface;
public TRpcClientFactoryBean(String name, Class serviceInterface) {
this.name = Objects.requireNonNull(name);
this.serviceInterface = Objects.requireNonNull(serviceInterface);
}
@Override
public T getObject() {
return TRpcProxy.getProxy(name, serviceInterface);
}
@Override
public Class> getObjectType() {
return serviceInterface;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy