Hello @kartik,
You can set port in java code:
HashMap<String, Object> props = new HashMap<>();
props.put("server.port", 9999);
new SpringApplicationBuilder()
.sources(SampleController.class)
.properties(props)
.run(args);
Or in application.yml:
server:
port: 9999
Or in application.properties:
server.port=9999
Or as a command line parameter:
-Dserver.port=9999
Hope this works!!
Get your Spring Certification today to become certified.