I have a very simple "Hello World" kind of REST api created using Spring Boot that is accessible through http://localhost:8080/greeting/world without any problem.
I would like to start two more instances of this API on ports 8081 and 8082 but not able to do so. It says java.net.BindException: Address already in use: bind
Command Used:
mvn spring-boot:run -Dserver.port=8081
application.yml
spring:
application:
name: world-greeting-service
WorldGreetingServiceApplication.java
@RestController
@SpringBootApplication
public class WorldGreetingServiceApplication {
public static void main(String[] args) {
SpringApplication.run(WorldGreetingServiceApplication.class, args);
}
@RequestMapping("/greeting/world")
public String greetWorld() {
return "Hello World!";
}
}
Am I missing anything?