Search in sources :

Example 1 with SwaggerRestService

use of com.alipay.sofa.rpc.doc.swagger.rest.SwaggerRestService in project sofa-rpc by sofastack.

the class BoltServerMainWithSwagger method main.

public static void main(String[] args) {
    ApplicationConfig application = new ApplicationConfig().setAppName("test-server");
    ServerConfig serverConfig = new ServerConfig().setPort(22000).setDaemon(false);
    ProviderConfig<HelloService> providerConfig = new ProviderConfig<HelloService>().setInterfaceId(HelloService.class.getName()).setApplication(application).setRef(new HelloServiceImpl()).setServer(serverConfig).setRegister(false);
    ProviderConfig<EchoService> providerConfig2 = new ProviderConfig<EchoService>().setInterfaceId(EchoService.class.getName()).setApplication(application).setRef(new EchoServiceImpl()).setServer(serverConfig).setRegister(false);
    providerConfig.export();
    providerConfig2.export();
    ServerConfig restServer = new ServerConfig().setProtocol("rest").setPort(8888).setDaemon(false);
    ProviderConfig<SwaggerRestService> restProviderConfig = new ProviderConfig<SwaggerRestService>().setInterfaceId(SwaggerRestService.class.getName()).setApplication(application).setRef(new SwaggerRestServiceImpl()).setBootstrap("rest").setServer(restServer).setRegister(false);
    restProviderConfig.export();
    LOGGER.warn("started at pid {}", RpcRuntimeContext.PID);
}
Also used : SwaggerRestServiceImpl(com.alipay.sofa.rpc.doc.swagger.rest.SwaggerRestServiceImpl) ServerConfig(com.alipay.sofa.rpc.config.ServerConfig) SwaggerRestService(com.alipay.sofa.rpc.doc.swagger.rest.SwaggerRestService) ApplicationConfig(com.alipay.sofa.rpc.config.ApplicationConfig) EchoService(com.alipay.sofa.rpc.test.EchoService) ProviderConfig(com.alipay.sofa.rpc.config.ProviderConfig) HelloService(com.alipay.sofa.rpc.test.HelloService) HelloServiceImpl(com.alipay.sofa.rpc.test.HelloServiceImpl) EchoServiceImpl(com.alipay.sofa.rpc.test.EchoServiceImpl)

Aggregations

ApplicationConfig (com.alipay.sofa.rpc.config.ApplicationConfig)1 ProviderConfig (com.alipay.sofa.rpc.config.ProviderConfig)1 ServerConfig (com.alipay.sofa.rpc.config.ServerConfig)1 SwaggerRestService (com.alipay.sofa.rpc.doc.swagger.rest.SwaggerRestService)1 SwaggerRestServiceImpl (com.alipay.sofa.rpc.doc.swagger.rest.SwaggerRestServiceImpl)1 EchoService (com.alipay.sofa.rpc.test.EchoService)1 EchoServiceImpl (com.alipay.sofa.rpc.test.EchoServiceImpl)1 HelloService (com.alipay.sofa.rpc.test.HelloService)1 HelloServiceImpl (com.alipay.sofa.rpc.test.HelloServiceImpl)1