Registration requires a registry to store the microservices in the server. The client microservices on startup makes a REST API request to the server /register method with the name, host and port. There can be multiple instances of each microservice with the same name. The server sends back the response with the unique ID assigned to that microservice instance (this name and ID combination should be sent in subsequent requests).
Spring has CommandLineRunners which can be created in the api module and each client microservice could include it as a Maven Dependency. The microservices would define a properties file with the name of the microservice and then the host and port of the microservice would be queried from Spring in the runner.
Registration requires a registry to store the microservices in the server. The client microservices on startup makes a REST API request to the server /register method with the name, host and port. There can be multiple instances of each microservice with the same name. The server sends back the response with the unique ID assigned to that microservice instance (this name and ID combination should be sent in subsequent requests).
Spring has CommandLineRunners which can be created in the api module and each client microservice could include it as a Maven Dependency. The microservices would define a properties file with the name of the microservice and then the host and port of the microservice would be queried from Spring in the runner.