Skip to content

Latest commit

 

History

History
 
 

codefirst-sample

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

readme.md

Code First

It's the sample of code-first

You can write microservice without swagger contract.

how to write server code

Just write codes without swagger contract. When the server is starting, it will build the contract and register the service to the service center.

@RpcSchema(schemaId = "codeFirst")
public class CodeFirstPojo {
    public int reduce(int a, int b) {
        return a - b;
    }

    public Person sayHello(Person user) {
        user.setName("hello " + user.getName());
        return user;
    }

    public String saySomething(String prefix, Person user) {
        return prefix + " " + user.getName();
    }
    
}

How to run sample

1. Start the ServiceComb/Service Center

how to start the service center

2.Start the Microservice server

mvn test -Pserver

3.Start the Microservice client

mvn test -Pclient