Note that I commented out one line; that’s because otherwise there would be two instances of the app running, and then there would be a port conflict (since both use the same port).

package com.leibnix.lgn;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class LgnApplication {

	public static void main(String[] args) {

		ApplicationContext context = SpringApplication.run(LgnApplication.class, args);
		String port = context.getEnvironment().getProperty("server.port", "8080");

		//SpringApplication.run(LgnApplication.class, args);
		System.out.println("Application listening on port: " + port);
	}

}